-
Notifications
You must be signed in to change notification settings - Fork 35
/
RevocationServiceTest.kt
39 lines (30 loc) · 1.29 KB
/
RevocationServiceTest.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package id.walt.signatory
import id.walt.servicematrix.ServiceMatrix
import id.walt.test.RESOURCES_PATH
import io.kotest.core.spec.style.AnnotationSpec
import io.kotest.matchers.shouldBe
import io.kotest.matchers.shouldNotBe
class RevocationServiceTest : AnnotationSpec() {
init {
ServiceMatrix("$RESOURCES_PATH/service-matrix.properties")
RevocationService.clearRevocations()
}
@Test
fun test() {
val service = RevocationClientService.getService()
val baseToken = service.createBaseToken()
println("New base token: $baseToken")
val revocationToken = RevocationService.getRevocationToken(baseToken)
println("Revocation token derived from base token: $revocationToken")
println("Check revoked with derived token: $revocationToken")
val result1 = RevocationService.checkRevoked(revocationToken)
result1.isRevoked shouldBe false
result1.timeOfRevocation shouldBe null
println("Revoke with base token: $baseToken")
RevocationService.revokeToken(baseToken)
println("Check revoked with derived token: $revocationToken")
val result2 = RevocationService.checkRevoked(revocationToken)
result2.isRevoked shouldBe true
result2.timeOfRevocation shouldNotBe null
}
}