Skip to content

Commit

Permalink
chore(test): Use the right PDA chain in third party endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
gnarea committed Mar 10, 2021
1 parent 8f1998c commit 1aaa965
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ internal class PublicThirdPartyEndpointTest {
val privateAddress = UUID.randomUUID().toString()
val publicAddress = "example.org"
whenever(storage.publicThirdPartyCertificate.get(any()))
.thenReturn(PublicThirdPartyEndpoint.StoredData(publicAddress, PDACertPath.PUBLIC_GW))
.thenReturn(PublicThirdPartyEndpoint.StoredData(publicAddress, PDACertPath.PDA))

val endpoint = PublicThirdPartyEndpoint.load(privateAddress)!!
assertEquals(publicAddress, endpoint.publicAddress)
assertEquals("https://$publicAddress", endpoint.address)
assertEquals(PDACertPath.PUBLIC_GW, endpoint.identityCertificate)
assertEquals(PDACertPath.PDA, endpoint.identityCertificate)
}

@Test
Expand All @@ -50,17 +50,17 @@ internal class PublicThirdPartyEndpointTest {
@Test
fun import_successful() = runBlockingTest {
val publicAddress = "example.org"
with(PublicThirdPartyEndpoint.import(publicAddress, PDACertPath.PUBLIC_GW)) {
with(PublicThirdPartyEndpoint.import(publicAddress, PDACertPath.PDA)) {
assertEquals(publicAddress, this.publicAddress)
assertEquals(PDACertPath.PUBLIC_GW, identityCertificate)
assertEquals(PDACertPath.PDA, identityCertificate)
assertEquals("https://$publicAddress", this.address)
}

verify(storage.publicThirdPartyCertificate).set(
PDACertPath.PUBLIC_GW.subjectPrivateAddress,
PDACertPath.PDA.subjectPrivateAddress,
PublicThirdPartyEndpoint.StoredData(
publicAddress,
PDACertPath.PUBLIC_GW
PDACertPath.PDA
)
)
}
Expand All @@ -79,7 +79,7 @@ internal class PublicThirdPartyEndpointTest {
@Test
fun storedDataSerialization() {
val publicAddress = "example.org"
val certificate = PDACertPath.PUBLIC_GW
val certificate = PDACertPath.PDA

val dataSerialized =
PublicThirdPartyEndpoint.StoredData(publicAddress, certificate).serialize()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ internal class OutgoingMessageTest {
val message = MessageFactory.buildOutgoing(RecipientAddressType.PUBLIC)
val parcel = message.parcel

val serviceMessageDecrypted = parcel.unwrapPayload(KeyPairSet.PUBLIC_GW.private)
val serviceMessageDecrypted = parcel.unwrapPayload(KeyPairSet.PDA_GRANTEE.private)
assertEquals(MessageFactory.serviceMessage.type, serviceMessageDecrypted.type)
assertArrayEquals(MessageFactory.serviceMessage.content, serviceMessageDecrypted.content)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ internal object ThirdPartyEndpointFactory {

fun buildPublic(): PublicThirdPartyEndpoint = PublicThirdPartyEndpoint(
"example.org",
PDACertPath.PUBLIC_GW
PDACertPath.PDA
)

fun buildPrivate(): PrivateThirdPartyEndpoint = PrivateThirdPartyEndpoint(
private fun buildPrivate(): PrivateThirdPartyEndpoint = PrivateThirdPartyEndpoint(
UUID.randomUUID().toString(),
PDACertPath.PRIVATE_ENDPOINT,
PDACertPath.PRIVATE_ENDPOINT
Expand Down

0 comments on commit 1aaa965

Please sign in to comment.