Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(tests): fixed ingored tests for E2EI (WPB-6286) #2697

Merged
merged 4 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ import kotlin.test.assertEquals
import kotlin.test.assertTrue
import kotlin.time.Duration.Companion.days

@Ignore
@IgnoreJS
@IgnoreIOS
class E2EIClientTest : BaseMLSClientTest() {
data class SampleUser(
val id: CryptoQualifiedID, val clientId: CryptoClientId, val name: String, val handle: String, val teamId: String? = ""
Expand All @@ -43,9 +44,9 @@ class E2EIClientTest : BaseMLSClientTest() {
fun givenClient_whenPassingAcmeDirectoryResponse_ReturnNonEmptyResult() = runTest {
val e2eiClient = createE2EIClient(ALICE1)
val expectedDirectory = AcmeDirectory(
"https://balderdash.hogwash.work:9000/acme/wire/new-nonce",
"https://balderdash.hogwash.work:9000/acme/wire/new-account",
"https://balderdash.hogwash.work:9000/acme/wire/new-order"
"https://acme.elna.wire.link/acme/keycloakteams/new-nonce",
"https://acme.elna.wire.link/acme/keycloakteams/new-account",
"https://acme.elna.wire.link/acme/keycloakteams/new-order"
)
val directory = e2eiClient.directoryResponse(ACME_DIRECTORY_API_RESPONSE)
assertEquals(expectedDirectory, directory)
Expand All @@ -72,7 +73,8 @@ class E2EIClientTest : BaseMLSClientTest() {
e2eiClient.directoryResponse(ACME_DIRECTORY_API_RESPONSE)
e2eiClient.setAccountResponse(NEW_ACCOUNT_API_RESPONSE)
e2eiClient.setOrderResponse(NEW_ORDER_API_RESPONSE)
assertTrue(e2eiClient.getNewAuthzRequest(AUTHZ_URL, NONCE).isNotEmpty())
assertTrue(e2eiClient.getNewAuthzRequest(AUTHZ_URL1, NONCE).isNotEmpty())
assertTrue(e2eiClient.getNewAuthzRequest(AUTHZ_URL2, NONCE).isNotEmpty())
}

@Test
Expand All @@ -81,19 +83,17 @@ class E2EIClientTest : BaseMLSClientTest() {
e2eiClient.directoryResponse(ACME_DIRECTORY_API_RESPONSE)
e2eiClient.setAccountResponse(NEW_ACCOUNT_API_RESPONSE)
e2eiClient.setOrderResponse(NEW_ORDER_API_RESPONSE)
e2eiClient.setAuthzResponse(AUTHZ_API_RESPONSE)
e2eiClient.setAuthzResponse(DPOP_AUTHZ_API_RESPONSE)
assertTrue(e2eiClient.createDpopToken(NONCE).isNotEmpty())
}

//todo: fix later
@Ignore
@Test
fun givenClient_whenCallingGetNewDpopChallengeRequest_ReturnNonEmptyResult() = runTest {
val e2eiClient = createE2EIClient(ALICE1)
e2eiClient.directoryResponse(ACME_DIRECTORY_API_RESPONSE)
e2eiClient.setAccountResponse(NEW_ACCOUNT_API_RESPONSE)
e2eiClient.setOrderResponse(NEW_ORDER_API_RESPONSE)
e2eiClient.setAuthzResponse(AUTHZ_API_RESPONSE)
e2eiClient.setAuthzResponse(DPOP_AUTHZ_API_RESPONSE)
e2eiClient.createDpopToken(NONCE)
assertTrue(e2eiClient.getNewDpopChallengeRequest(ACCESS_TOKEN_RESPONSE, NONCE).isNotEmpty())
}
Expand All @@ -104,7 +104,8 @@ class E2EIClientTest : BaseMLSClientTest() {
e2eiClient.directoryResponse(ACME_DIRECTORY_API_RESPONSE)
e2eiClient.setAccountResponse(NEW_ACCOUNT_API_RESPONSE)
e2eiClient.setOrderResponse(NEW_ORDER_API_RESPONSE)
e2eiClient.setAuthzResponse(AUTHZ_API_RESPONSE)
e2eiClient.setAuthzResponse(DPOP_AUTHZ_API_RESPONSE)
e2eiClient.setAuthzResponse(OIDC_AUTHZ_API_RESPONSE)
e2eiClient.createDpopToken(NONCE)
assertTrue(e2eiClient.getNewOidcChallengeRequest(OAUTH_ID_TOKEN, REFRESH_TOKEN, NONCE).isNotEmpty())
}
Expand All @@ -116,7 +117,10 @@ class E2EIClientTest : BaseMLSClientTest() {
e2eiClient.directoryResponse(ACME_DIRECTORY_API_RESPONSE)
e2eiClient.setAccountResponse(NEW_ACCOUNT_API_RESPONSE)
e2eiClient.setOrderResponse(NEW_ORDER_API_RESPONSE)
e2eiClient.setAuthzResponse(AUTHZ_API_RESPONSE)
e2eiClient.getNewAuthzRequest(AUTHZ_URL1, NONCE)
e2eiClient.getNewAuthzRequest(AUTHZ_URL2, NONCE)
e2eiClient.setAuthzResponse(OIDC_AUTHZ_API_RESPONSE)
e2eiClient.setAuthzResponse(DPOP_AUTHZ_API_RESPONSE)
e2eiClient.createDpopToken(NONCE)
e2eiClient.setDPoPChallengeResponse(DPOP_CHALLENGE_RESPONSE)
e2eiClient.getNewOidcChallengeRequest(OAUTH_ID_TOKEN, REFRESH_TOKEN, NONCE)
Expand All @@ -131,7 +135,10 @@ class E2EIClientTest : BaseMLSClientTest() {
e2eiClient.directoryResponse(ACME_DIRECTORY_API_RESPONSE)
e2eiClient.setAccountResponse(NEW_ACCOUNT_API_RESPONSE)
e2eiClient.setOrderResponse(NEW_ORDER_API_RESPONSE)
e2eiClient.setAuthzResponse(AUTHZ_API_RESPONSE)
e2eiClient.getNewAuthzRequest(AUTHZ_URL1, NONCE)
e2eiClient.getNewAuthzRequest(AUTHZ_URL2, NONCE)
e2eiClient.setAuthzResponse(OIDC_AUTHZ_API_RESPONSE)
e2eiClient.setAuthzResponse(DPOP_AUTHZ_API_RESPONSE)
e2eiClient.createDpopToken(NONCE)
e2eiClient.setDPoPChallengeResponse(DPOP_CHALLENGE_RESPONSE)
e2eiClient.getNewOidcChallengeRequest(OAUTH_ID_TOKEN, REFRESH_TOKEN, NONCE)
Expand All @@ -147,7 +154,10 @@ class E2EIClientTest : BaseMLSClientTest() {
e2eiClient.directoryResponse(ACME_DIRECTORY_API_RESPONSE)
e2eiClient.setAccountResponse(NEW_ACCOUNT_API_RESPONSE)
e2eiClient.setOrderResponse(NEW_ORDER_API_RESPONSE)
e2eiClient.setAuthzResponse(AUTHZ_API_RESPONSE)
e2eiClient.getNewAuthzRequest(AUTHZ_URL1, NONCE)
e2eiClient.getNewAuthzRequest(AUTHZ_URL2, NONCE)
e2eiClient.setAuthzResponse(OIDC_AUTHZ_API_RESPONSE)
e2eiClient.setAuthzResponse(DPOP_AUTHZ_API_RESPONSE)
e2eiClient.createDpopToken(NONCE)
e2eiClient.setDPoPChallengeResponse(DPOP_CHALLENGE_RESPONSE)
e2eiClient.getNewOidcChallengeRequest(OAUTH_ID_TOKEN, REFRESH_TOKEN, NONCE)
Expand All @@ -169,11 +179,11 @@ class E2EIClientTest : BaseMLSClientTest() {

val ACME_DIRECTORY_API_RESPONSE = """
{
"newNonce": "https://balderdash.hogwash.work:9000/acme/wire/new-nonce",
"newAccount": "https://balderdash.hogwash.work:9000/acme/wire/new-account",
"newOrder": "https://balderdash.hogwash.work:9000/acme/wire/new-order",
"revokeCert": "https://balderdash.hogwash.work:9000/acme/wire/revoke-cert",
"keyChange": "https://balderdash.hogwash.work:9000/acme/wire/key-change"
"newNonce": "https://acme.elna.wire.link/acme/keycloakteams/new-nonce",
"newAccount": "https://acme.elna.wire.link/acme/keycloakteams/new-account",
"newOrder": "https://acme.elna.wire.link/acme/keycloakteams/new-order",
"revokeCert": "https://acme.elna.wire.link/acme/keycloakteams/revoke-cert",
"keyChange": "https://acme.elna.wire.link/acme/keycloakteams/key-change"
}
""".toByteArray()

Expand All @@ -182,60 +192,80 @@ class E2EIClientTest : BaseMLSClientTest() {

val NEW_ACCOUNT_API_RESPONSE = """
{
"contact":["[email protected]"],
"status":"valid",
"orders":"https://balderdash.hogwash.work:9000/acme/wire/account/9wXZb701i4JTE4ODOP5aMfsLJn7tpJ3B/orders"
"contact": ["[email protected]"],
"status": "valid",
"orders": "https://acme.elna.wire.link/acme/keycloakteams/account/9ftonrYafcLPjIGsFyABdgnen9TLrBpv/orders"
}""".toByteArray()

val AUTHZ_URL = "https://balderdash.hogwash.work:9000/acme/wire/authz/CSGJUN9BQ0mhELCBbvBJI7AlxcAH9ypD"
val AUTHZ_URL1 = "https://acme.elna.wire.link/acme/keycloakteams/authz/1gpp07FUGPh6bFhnAZTuhhPIoGAx2xpw"
val AUTHZ_URL2 = "https://acme.elna.wire.link/acme/keycloakteams/authz/mGCAn2FaKAVlO7n2MXdCaRjRsSwEHrel"

val FINALIZE_ORDER_URL = "https://balderdash.hogwash.work:9000/acme/wire/order/Q4LJjBnX7rA8dwxVreikzmVJBfCvrVs0/finalize"
val FINALIZE_ORDER_URL = "https://acme.elna.wire.link/acme/keycloakteams/order/c9mGRDNE7YRVRbk6jokwXNXPgU1n37iS/finalize"

val NEW_ORDER_API_RESPONSE = """
{
"id":"Q4LJjBnX7rA8dwxVreikzmVJBfCvrVs0",
"status":"pending",
"expires":"3000-05-08T12:00:50Z",
"identifiers":[
{
"type":"wireapp-id",
"value":"{\"name\":\"Mojtaba Chenani\",\"domain\":\"elna.wire.link\",\"client-id\":\"im:wireapp=IG9YvzuWQIKUaRk12F5CIQ/[email protected]\",\"handle\":\"im:wireapp=mojtaba_wire\"}"
}
],
"notBefore":"2023-05-07T12:00:50.1666Z",
"notAfter":"3000-08-05T12:00:50.1666Z",
"authorizations":[
"$AUTHZ_URL"
],
"finalize":"$FINALIZE_ORDER_URL"
}""".toByteArray()
"id": "c9mGRDNE7YRVRbk6jokwXNXPgU1n37iS",
"status": "pending",
"expires": "3000-04-04T09:42:17Z",
"identifiers": [
{
"type": "wireapp-device",
"value": "{\"client-id\":\"wireapp://[email protected]\",\"handle\":\"wireapp://%[email protected]\",\"name\":\"Brigette Miller\",\"domain\":\"elna.wire.link\"}"
},
{
"type": "wireapp-user",
"value": "{\"handle\":\"wireapp://%[email protected]\",\"name\":\"Brigette Miller\",\"domain\":\"elna.wire.link\"}"
}
],
"notBefore":"2023-05-07T12:00:50.1666Z",
"notAfter":"3000-08-05T12:00:50.1666Z",
"authorizations": [
"$AUTHZ_URL1",
"$AUTHZ_URL2"
],
"finalize": "$FINALIZE_ORDER_URL"
}
""".toByteArray()

val AUTHZ_API_RESPONSE = """
val DPOP_AUTHZ_API_RESPONSE = """
{
"challenges": [
{
"status": "pending",
"target": "https://accounts.google.com",
"token": "b0xOVyQP7BXih0LkIEQRBCFjaHtmFpXR",
"type": "wire-oidc-01",
"url": "https://balderdash.hogwash.work:9000/acme/google-android/challenge/hHt8EBiiek0yxnVdjnA3WiF0ieDNQZmk/9IcPupsVVSR7vqalj1LqqZnGlAXFmmUI"
},
{
"status": "pending",
"target": "https://nginz-https.anta.wire.link/v4/clients/89f1c4056c99edcb/access-token",
"token": "b0xOVyQP7BXih0LkIEQRBCFjaHtmFpXR",
"type": "wire-dpop-01",
"url": "https://balderdash.hogwash.work:9000/acme/google-android/challenge/hHt8EBiiek0yxnVdjnA3WiF0ieDNQZmk/Z7WTwaKyyJf6icWRxLauZS9y5JuCtxUR"
}
],
"expires": "3000-06-07T10:22:49Z",
"identifier": {
"type": "wireapp-id",
"value":"{\"name\":\"Mojtaba Chenani\",\"domain\":\"elna.wire.link\",\"client-id\":\"im:wireapp=IG9YvzuWQIKUaRk12F5CIQ/[email protected]\",\"handle\":\"im:wireapp=mojtaba_wire\"}"
},
"status": "pending",
"wildcard": false
"identifier": {
"type": "wireapp-device",
"value": "{\"client-id\":\"wireapp://[email protected]\",\"handle\":\"wireapp://%[email protected]\",\"name\":\"Brigette Miller\",\"domain\":\"elna.wire.link\"}"
},
"status": "pending",
"challenges": [
{
"type": "wire-dpop-01",
"status": "pending",
"token": "jA1p6uxBXOd7jguZMRDl5f26IO5s4JCA",
"url": "https://acme.elna.wire.link/acme/keycloakteams/challenge/1gpp07FUGPh6bFhnAZTuhhPIoGAx2xpw/33vBSFmrKO9SEjLM5p8y2Wzc7tXvsbd6",
"target": "https://elna.wire.link/clients/a07b91b6fc50a19a/access-token"
}
],
"wildcard": false,
"expires": "3000-04-04T09:42:17Z"
}""".toByteArray()
val OIDC_AUTHZ_API_RESPONSE = """
{
"identifier": {
"type": "wireapp-user",
"value": "{\"handle\":\"wireapp://%[email protected]\",\"name\":\"Brigette Miller\",\"domain\":\"elna.wire.link\"}"
},
"status": "pending",
"challenges": [
{
"type": "wire-oidc-01",
"status": "pending",
"token": "m9kZjmdnBBbqeUAEIdLsPMYhczn7k5HY",
"url": "https://acme.elna.wire.link/acme/keycloakteams/challenge/mGCAn2FaKAVlO7n2MXdCaRjRsSwEHrel/I7RRkAbZ3ZiqLbpPd0dgLqHFMy0IY1t2",
"target": "https://keycloak.bund-next.wire.link/auth/realms/master?client_id=wireapp"
}
],
"wildcard": false,
"expires": "3000-04-04T09:42:17Z"
}
""".toByteArray()

val ACCESS_TOKEN_RESPONSE = """
{
Expand All @@ -249,55 +279,70 @@ class E2EIClientTest : BaseMLSClientTest() {

val DPOP_CHALLENGE_RESPONSE = """
{
"type":"wire-dpop-01",
"url":"https://balderdash.hogwash.work:9000/acme/wire/challenge/iO6dShnf4v4ibIkpUMDYJWFh6ndSMjGx/fJLaKSLTGiztUJXz6YDJnxoJI0na26Fr",
"status":"valid",
"token":"LxjI5PTyVvQNzeorQcORn89DmGPZdG7K",
"nonce":"WWFsUjlkMm9rVWZJZE9FWHoxcmRqMUxPR3JtTFFVeG8"
"type": "wire-dpop-01",
"status": "valid",
"token": "nJMkyBgGovLoMFCK3AvxEZg3IDPnHaaB",
"validated": "2024-04-03T11:09:49Z",
"url": "https://acme.elna.wire.link/acme/keycloakteams/challenge/lHJZD35qsabL3O6zmnhphK0G3NBhmJir/jIfnktV1nSrDdJ5zuBoUnH90V65hfuCA",
"target": "https://elna.wire.link/clients/a07b91b6fc50a19a/access-token"
}""".toByteArray()

val OIDC_CHALLENGE_RESPONSE = """
{
"type":"wire-oidc-01",
"url":"https://balderdash.hogwash.work:9000/acme/wire/challenge/iO6dShnf4v4ibIkpUMDYJWFh6ndSMjGx/mIgff1EJsncnHZfK98A6ARbsH69z8Dpp",
"status":"valid", "token":"LxjI5PTyVvQNzeorQcORn89DmGPZdG7K",
"nonce":"UW9YY2RraDNQOGZ0QUpYVUt5cDhwVVVSRUV1RDd3akw"
"type": "wire-oidc-01",
"status": "valid",
"token": "p7GkU6IOPQWtWwKIk56CenepIR3y4bMj",
"validated": "2024-04-03T11:09:49Z",
"url": "https://acme.elna.wire.link/acme/keycloakteams/challenge/YsZCZdrVlh56Icla8k8PJuPhD3MZsogs/JghpemWlBCI6TKRcQNfWQKpsoDlZDWDz",
"target": "https://keycloak.bund-next.wire.link/auth/realms/master?client_id=wireapp"
}""".toByteArray()

val ORDER_RESPONSE = """
{
"status": "ready",
"finalize": "https://localhost:55170/acme/acme/order/FaKNEM5iL79ROLGJdO1DXVzIq5rxPEob/finalize",
"identifiers": [
{
"type": "wireapp-id",
"value":"{\"name\":\"Mojtaba Chenani\",\"domain\":\"elna.wire.link\",\"client-id\":\"im:wireapp=IG9YvzuWQIKUaRk12F5CIQ/[email protected]\",\"handle\":\"im:wireapp=mojtaba_wire\"}"
}
],
"authorizations": [
"https://localhost:55170/acme/acme/authz/ZelRfonEK02jDGlPCJYHrY8tJKNsH0mw"
],
"expires": "3000-02-10T14:59:20Z",
"notBefore": "2013-02-09T14:59:20.442908Z",
"notAfter": "3000-02-09T15:59:20.442908Z"
"id": "goywLpfyiGbt0ZrQ4bQyklwG70RrWIYi",
"status": "ready",
"expires": "3000-04-04T11:09:26Z",
"identifiers": [
{
"type": "wireapp-device",
"value": "{\"client-id\":\"wireapp://[email protected]\",\"handle\":\"wireapp://%[email protected]\",\"name\":\"Brigette Miller\",\"domain\":\"elna.wire.link\"}"
},
{
"type": "wireapp-user",
"value": "{\"handle\":\"wireapp://%[email protected]\",\"name\":\"Brigette Miller\",\"domain\":\"elna.wire.link\"}"
}
],
"notBefore": "2024-04-03T11:09:28.536894572Z",
"notAfter": "3000-07-02T11:09:28.536894572Z",
"authorizations": [
"https://acme.elna.wire.link/acme/keycloakteams/authz/lHJZD35qsabL3O6zmnhphK0G3NBhmJir",
"https://acme.elna.wire.link/acme/keycloakteams/authz/YsZCZdrVlh56Icla8k8PJuPhD3MZsogs"
],
"finalize": "https://acme.elna.wire.link/acme/keycloakteams/order/goywLpfyiGbt0ZrQ4bQyklwG70RrWIYi/finalize"
}""".toByteArray()
val FINALIZE_RESPONSE = """
{
"certificate": "https://localhost:55170/acme/acme/certificate/rLhCIYygqzWhUmP1i5tmtZxFUvJPFxSL",
"status": "valid",
"finalize": "https://localhost:55170/acme/acme/order/FaKNEM5iL79ROLGJdO1DXVzIq5rxPEob/finalize",
"identifiers": [
{
"type": "wireapp-id",
"value":"{\"name\":\"Mojtaba Chenani\",\"domain\":\"elna.wire.link\",\"client-id\":\"im:wireapp=IG9YvzuWQIKUaRk12F5CIQ/[email protected]\",\"handle\":\"im:wireapp=mojtaba_wire\"}"
}
],
"authorizations": [
"https://localhost:55170/acme/acme/authz/ZelRfonEK02jDGlPCJYHrY8tJKNsH0mw"
],
"expires": "3000-02-10T14:59:20Z",
"notBefore": "2013-02-09T14:59:20.442908Z",
"notAfter": "3000-02-09T15:59:20.442908Z"
"id": "goywLpfyiGbt0ZrQ4bQyklwG70RrWIYi",
"status": "valid",
"expires": "3000-04-04T11:09:26Z",
"identifiers": [
{
"type": "wireapp-device",
"value": "{\"client-id\":\"wireapp://[email protected]\",\"handle\":\"wireapp://%[email protected]\",\"name\":\"Brigette Miller\",\"domain\":\"elna.wire.link\"}"
},
{
"type": "wireapp-user",
"value": "{\"handle\":\"wireapp://%[email protected]\",\"name\":\"Brigette Miller\",\"domain\":\"elna.wire.link\"}"
}
],
"notBefore": "2024-04-03T11:09:28.536894572Z",
"notAfter": "3000-07-02T11:09:28.536894572Z",
"authorizations": [
"https://acme.elna.wire.link/acme/keycloakteams/authz/lHJZD35qsabL3O6zmnhphK0G3NBhmJir",
"https://acme.elna.wire.link/acme/keycloakteams/authz/YsZCZdrVlh56Icla8k8PJuPhD3MZsogs"
],
"finalize": "https://acme.elna.wire.link/acme/keycloakteams/order/goywLpfyiGbt0ZrQ4bQyklwG70RrWIYi/finalize",
"certificate": "https://acme.elna.wire.link/acme/keycloakteams/certificate/cMFLY1InYUGVfOdrlgx9zoAIvipW6ocf"
}""".toByteArray()
}
}
Loading
Loading