@@ -30,7 +30,9 @@ import io.ktor.server.response.*
3030import io.ktor.server.routing.*
3131import io.ktor.server.testing.*
3232import kotlinx.coroutines.test.runTest
33+ import java.io.File
3334import java.net.URI
35+ import java.util.Base64
3436import kotlin.test.Test
3537import kotlin.test.assertEquals
3638import kotlin.test.assertIs
@@ -70,9 +72,14 @@ class AuthorizationResponseDispatcherTest {
7072 clientData = " client data" ,
7173 )
7274
75+ val signedDocument = File (ClassLoader .getSystemResource(" sample.pdf" ).path).readBytes()
76+
77+ val expectedDocument = Base64 .getEncoder().encodeToString(signedDocument)
78+ val expectedSignature = " MIAGCSqAMIACAQExDzANBglghkgBZQMEAgEFADCABgkqhkiGSs4rEsQV4AAAAAAAAA=="
79+
7380 val consensus = Consensus .Positive (
74- documentWithSignature = listOf (" document with signature " ),
75- signatureObject = listOf (" signature object " ),
81+ documentWithSignature = listOf (signedDocument ),
82+ signatureObject = listOf (expectedSignature ),
7683 )
7784
7885 testApplication {
@@ -93,8 +100,8 @@ class AuthorizationResponseDispatcherTest {
93100 call.request.headers[" Content-Type" ],
94101 )
95102 assertEquals(state, stateParam)
96- assertEquals(" [\" document with signature \" ]" , documentWithSignature)
97- assertEquals(" [\" signature object \" ]" , signatureObject)
103+ assertEquals(" [\" $expectedDocument \" ]" , documentWithSignature)
104+ assertEquals(" [\" $expectedSignature \" ]" , signatureObject)
98105 assertNotNull(signatureObject)
99106
100107 call.respond(HttpStatusCode .OK )
@@ -116,7 +123,7 @@ class AuthorizationResponseDispatcherTest {
116123 consensus,
117124 )
118125
119- assertIs<DispatchOutcome >(outcome)
126+ assertIs<DispatchOutcome . Accepted >(outcome)
120127 }
121128 }
122129
0 commit comments