Skip to content
This repository has been archived by the owner on Aug 1, 2023. It is now read-only.

Commit

Permalink
fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
atoulme committed May 4, 2020
1 parent a3228ab commit c96b3b7
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class DNSEntryTest {
val exception: InvalidEntryException = assertThrows {
DNSEntry.readDNSEntry("garbage")
}
assertEquals("garbage should contain enrtree-branch, enr, enrtree-root or enrtree-link", exception.message)
assertEquals("garbage should contain enrtree-branch, enr, enrtree-root or enrtree", exception.message)
}

@Test
Expand All @@ -47,22 +47,22 @@ class DNSEntryTest {
val exception: InvalidEntryException = assertThrows {
DNSEntry.readDNSEntry("garbage=abc def=gfh")
}
assertEquals("garbage=abc def=gfh should contain enrtree-branch, enr, enrtree-root or enrtree-link",
assertEquals("garbage=abc def=gfh should contain enrtree-branch, enr, enrtree-root or enrtree",
exception.message)
}

@Test
fun missingSigEntry() {
val exception: InvalidEntryException = assertThrows {
DNSEntry.readDNSEntry("enrtree-root=v1 hash=TO4Q75OQ2N7DX4EOOR7X66A6OM seq=3")
DNSEntry.readDNSEntry("enrtree-root:v1 hash=TO4Q75OQ2N7DX4EOOR7X66A6OM seq=3")
}
assertEquals("Missing attributes on root entry", exception.message)
}

@Test
fun missingSeqEntry() {
val exception: InvalidEntryException = assertThrows {
DNSEntry.readDNSEntry("enrtree-root=v1 e=TO4Q75OQ2N7DX4EOOR7X66A6OM l=TO4Q75OQ2N7DX4EOOR7X66A6OM" +
DNSEntry.readDNSEntry("enrtree-root:v1 e=TO4Q75OQ2N7DX4EOOR7X66A6OM l=TO4Q75OQ2N7DX4EOOR7X66A6OM" +
" sig=N-YY6UB9xD0hFx1Gmnt7v0RfSxch5tKyry2SRDoLx7B4GfPXagwLxQqyf7gAMvApFn_ORwZQekMWa_pXrcGCtwE=")
}
assertEquals("Missing attributes on root entry", exception.message)
Expand All @@ -80,9 +80,10 @@ class DNSEntryTest {
@Test
fun testValidENRTreeLink() {
val entry = DNSEntry.readDNSEntry(
"enrtree-link:morenodes.example.org")
"enrtree://aabb@morenodes.example.org")
as ENRTreeLink
assertEquals("morenodes.example.org", entry.domainName)
assertEquals("aabb", entry.pubKey)
}

@Test
Expand Down Expand Up @@ -126,9 +127,9 @@ class DNSEntryTest {

@Test
fun testEntryLinkToString() {
val entry = DNSEntry.readDNSEntry("enrtree-link:AM5FCQLWIZX2QFPNJAP7VUERCCRNGRHWZG3YYHIUV7B" +
val entry = DNSEntry.readDNSEntry("enrtree://AM5FCQLWIZX2QFPNJAP7VUERCCRNGRHWZG3YYHIUV7B" +
"VDQ5FDPRT2@morenodes.example.org")
assertEquals("enrtree-link=AM5FCQLWIZX2QFPNJAP7VUERCCRNGRHWZG3YYHIUV7BVDQ5FDPRT2@morenodes.example.org",
assertEquals("enrtree://AM5FCQLWIZX2QFPNJAP7VUERCCRNGRHWZG3YYHIUV7BVDQ5FDPRT2@morenodes.example.org",
entry.toString())
}
}

0 comments on commit c96b3b7

Please sign in to comment.