Skip to content

Commit

Permalink
🐛 Reconfigure ACAPY_AUTO_ACCEPT_REQUESTS for Faber after test completes
Browse files Browse the repository at this point in the history
  • Loading branch information
ff137 committed Oct 17, 2024
1 parent cd9ae6f commit 9b573d2
Showing 1 changed file with 49 additions and 40 deletions.
89 changes: 49 additions & 40 deletions app/tests/e2e/test_did_exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,51 +115,60 @@ async def test_accept_did_exchange_invitation(
json={"extra_settings": {"ACAPY_AUTO_ACCEPT_REQUESTS": False}},
)

faber_public_did = await acapy_wallet.get_public_did(controller=faber_acapy_client)
try:
faber_public_did = await acapy_wallet.get_public_did(
controller=faber_acapy_client
)

request_data = {"their_public_did": qualified_did_sov(faber_public_did.did)}
request_data = {"their_public_did": qualified_did_sov(faber_public_did.did)}

alice_create_request_response = await alice_member_client.post(
f"{CONNECTIONS_BASE_PATH}/did-exchange/create-request", params=request_data
)
alice_create_request_response = alice_create_request_response.json()
alice_create_request_response = await alice_member_client.post(
f"{CONNECTIONS_BASE_PATH}/did-exchange/create-request", params=request_data
)
alice_create_request_response = alice_create_request_response.json()

alice_connection_id = alice_create_request_response["connection_id"]
alice_did = alice_create_request_response["my_did"]
alice_connection_id = alice_create_request_response["connection_id"]
alice_did = alice_create_request_response["my_did"]

faber_connection_request_received_event = await check_webhook_state(
faber_client,
topic="connections",
state="request-received",
filter_map={"their_did": alice_did},
)
faber_connection_request_received_event = await check_webhook_state(
faber_client,
topic="connections",
state="request-received",
filter_map={"their_did": alice_did},
)

faber_connection_id = faber_connection_request_received_event["connection_id"]
faber_connection_id = faber_connection_request_received_event["connection_id"]

accept_params = {
"connection_id": faber_connection_id,
"use_public_did": use_public_did,
}
accept_params = {
"connection_id": faber_connection_id,
"use_public_did": use_public_did,
}

faber_accept_request_response = await faber_client.post(
f"{CONNECTIONS_BASE_PATH}/did-exchange/accept-request", params=accept_params
)
assert faber_accept_request_response.status_code == 200
accept_response = faber_accept_request_response.json()
assert accept_response["state"] == "response-sent"

# Now Alice's connection is complete
assert await check_webhook_state(
alice_member_client,
topic="connections",
state="completed",
filter_map={"connection_id": alice_connection_id},
)
faber_accept_request_response = await faber_client.post(
f"{CONNECTIONS_BASE_PATH}/did-exchange/accept-request", params=accept_params
)
assert faber_accept_request_response.status_code == 200
accept_response = faber_accept_request_response.json()
assert accept_response["state"] == "response-sent"

# And Faber's connection is complete
assert await check_webhook_state(
faber_client,
topic="connections",
state="completed",
filter_map={"connection_id": faber_connection_id},
)
# Now Alice's connection is complete
assert await check_webhook_state(
alice_member_client,
topic="connections",
state="completed",
filter_map={"connection_id": alice_connection_id},
)

# And Faber's connection is complete
assert await check_webhook_state(
faber_client,
topic="connections",
state="completed",
filter_map={"connection_id": faber_connection_id},
)
finally:
# Reconfigure ACAPY_AUTO_ACCEPT_REQUESTS for Faber
await tenant_admin_client.put(
f"{TENANTS_BASE_PATH}/{faber_wallet_id}",
json={"extra_settings": {"ACAPY_AUTO_ACCEPT_REQUESTS": True}},
)

0 comments on commit 9b573d2

Please sign in to comment.