Skip to content

Commit

Permalink
use check_webhook_state to check done
Browse files Browse the repository at this point in the history
  • Loading branch information
cl0ete committed Dec 5, 2024
1 parent 7db8db7 commit 50e96f3
Showing 1 changed file with 12 additions and 19 deletions.
31 changes: 12 additions & 19 deletions app/tests/util/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,33 +87,26 @@ async def create_bob_alice_connection(
).json()

# Get connection details
alice_connection = (
await alice_member_client.get(
f"{CONNECTIONS_BASE_PATH}/{alice_oob_response['connection_id']}"
)
).json()
alice_connection = await check_webhook_state(
client=alice_member_client,
topic="connections",
state="completed",
filter_map={"connection_id": alice_oob_response["connection_id"]},
)

# Use Alice's connection DID to fetch Bob's connection
their_did = alice_connection["my_did"]
bob_connections = (
await bob_member_client.get(
f"{CONNECTIONS_BASE_PATH}?their_did={their_did}",
)
).json()

assert (
len(bob_connections) == 1
), f"Bob should have 1 connection, got: {len(bob_connections)}"
bob_connection = bob_connections[0]
bob_connection = await check_webhook_state(
client=bob_member_client,
topic="connections",
state="completed",
filter_map={"their_did": their_did},
)

bob_connection_id = bob_connection["connection_id"]
alice_connection_id = alice_connection["connection_id"]

# validate both connections should be active
await assert_both_connections_ready(
alice_member_client, bob_member_client, alice_connection_id, bob_connection_id
)

return BobAliceConnect(
alice_connection_id=alice_connection_id, bob_connection_id=bob_connection_id
)
Expand Down

0 comments on commit 50e96f3

Please sign in to comment.