mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-12-25 12:27:58 +01:00
Test Certification class
This commit is contained in:
parent
aa826469f3
commit
2e3c83f1f6
1 changed files with 33 additions and 0 deletions
|
@ -0,0 +1,33 @@
|
||||||
|
package org.pgpainless.wot.dijkstra
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test
|
||||||
|
import org.pgpainless.wot.dijkstra.sq.CertSynopsis
|
||||||
|
import org.pgpainless.wot.dijkstra.sq.Certification
|
||||||
|
import org.pgpainless.wot.dijkstra.sq.Fingerprint
|
||||||
|
import org.pgpainless.wot.dijkstra.sq.RevocationState
|
||||||
|
import java.util.*
|
||||||
|
import kotlin.test.assertEquals
|
||||||
|
|
||||||
|
class CertificationTest {
|
||||||
|
|
||||||
|
private val alice = CertSynopsis(
|
||||||
|
Fingerprint("0000000000000000000000000000000000000000"),
|
||||||
|
null,
|
||||||
|
RevocationState.notRevoked(),
|
||||||
|
mapOf(Pair("Alice <alice@pgpainless.org>", RevocationState.notRevoked())))
|
||||||
|
private val bob = CertSynopsis(
|
||||||
|
Fingerprint("1111111111111111111111111111111111111111"),
|
||||||
|
null,
|
||||||
|
RevocationState.notRevoked(),
|
||||||
|
mapOf(Pair("Bob <bob@example.org>", RevocationState.notRevoked())))
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testToString() {
|
||||||
|
val certification = Certification(alice, "Bob <bob@example.org>", bob, Date())
|
||||||
|
assertEquals("0000000000000000000000000000000000000000 (Alice <alice@pgpainless.org>) certifies [Bob <bob@example.org>] 1111111111111111111111111111111111111111",
|
||||||
|
certification.toString())
|
||||||
|
val delegation = Certification(alice, null, bob, Date())
|
||||||
|
assertEquals("0000000000000000000000000000000000000000 (Alice <alice@pgpainless.org>) delegates to 1111111111111111111111111111111111111111",
|
||||||
|
delegation.toString())
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue