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 test to work with pytest-xdist #986

Merged
merged 3 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 1 addition & 3 deletions app/tests/e2e/issuer/test_save_exchange_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,7 @@ async def test_issue_credential_with_save_exchange_record(
},
)

time.sleep(
1
) # short sleep before fetching cred ex records; allow them to update
await asyncio.sleep(1) # short sleep before fetching; allow records to update

# faber requesting auto_remove only removes their cred ex records
# get exchange record from alice side -- should not exist after complete
Expand Down
19 changes: 14 additions & 5 deletions app/tests/e2e/test_wallet_dids.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,23 @@ async def create_did_mock(governance_client: RichAsyncClient):
async def test_list_dids(
governance_client: RichAsyncClient, mock_governance_auth: AcaPyAuthVerified
):
response = await governance_client.get(WALLET_BASE_PATH)
# Capture the existing DIDs before the request
initial_dids = await list_dids(auth=mock_governance_auth)
initial_dids_set = set(map(lambda x: x.did, initial_dids))

# Make the GET request
response = await governance_client.get(WALLET_BASE_PATH)
assert response.status_code == 200
response = response.json()
response_data = response.json()

# Filter the response to include only the initial DIDs
filtered_response_data = [
did_dict for did_dict in response_data if did_dict["did"] in initial_dids_set
]

res_method: List[DID] = await list_dids(auth=mock_governance_auth)
res_method_dict = list(map(lambda x: x.to_dict(), res_method))
assert res_method_dict == response
# Compare the filtered response with the initial DIDs
initial_dids_dict = list(map(lambda x: x.to_dict(), initial_dids))
assert filtered_response_data == initial_dids_dict


@pytest.mark.anyio
Expand Down
12 changes: 6 additions & 6 deletions app/tests/e2e/verifier/test_verifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,11 @@ async def test_saving_of_presentation_exchange_records(
VERIFIER_BASE_PATH + "/accept-request",
json=proof_accept.model_dump(),
)
result = response.json()

pres_exchange_result = PresentationExchange(**result)
assert isinstance(pres_exchange_result, PresentationExchange)
assert response.status_code == 200

await assert_both_webhooks_received(
alice_member_client,
Expand All @@ -640,12 +645,7 @@ async def test_saving_of_presentation_exchange_records(
acme_proof_id,
)

result = response.json()

pres_exchange_result = PresentationExchange(**result)
assert isinstance(pres_exchange_result, PresentationExchange)
assert response.status_code == 200

await asyncio.sleep(1) # short sleep before fetching records; allow them to update
# get exchange records from alice side
if alice_save_exchange_record:
# Save record is True, should be 1 record
Expand Down
Loading