Skip to content

Commit

Permalink
✅ re-add assertion that pagination returns unique records across pages
Browse files Browse the repository at this point in the history
  • Loading branch information
ff137 committed Aug 21, 2024
1 parent 386ae52 commit 315e95e
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 65 deletions.
35 changes: 17 additions & 18 deletions app/tests/e2e/issuer/test_get_records_paginated.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,24 +81,23 @@ async def test_get_credential_exchange_records_paginated(
assert len(credentials) == 0

# Test fetching unique records with pagination
# TODO: Skipping for now; we require ACA-Py / Askar record ordering to guarantee unique records across pages
# prev_credentials = []
# for offset in range(num_credentials_to_test):
# response = await faber_client.get(
# CREDENTIALS_BASE_PATH,
# params={
# "state": "offer-sent",
# "limit": 1,
# "offset": offset,
# },
# )

# credentials = response.json()
# assert len(credentials) == 1

# record = credentials[0]
# assert record not in prev_credentials
# prev_credentials.append(record)
prev_credentials = []
for offset in range(num_credentials_to_test):
response = await faber_client.get(
CREDENTIALS_BASE_PATH,
params={
"state": "offer-sent",
"limit": 1,
"offset": offset,
},
)

credentials = response.json()
assert len(credentials) == 1

record = credentials[0]
assert record not in prev_credentials
prev_credentials.append(record)

# Test invalid limit and offset values
invalid_params = [
Expand Down
35 changes: 17 additions & 18 deletions app/tests/e2e/test_connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,24 +298,23 @@ async def test_get_connections_paginated(
assert len(connections) == 0

# Test fetching unique records with pagination
# TODO: Skipping for now; we require ACA-Py / Askar record ordering to guarantee unique records across pages
# prev_connections = []
# for offset in range(num_connections_to_test):
# response = await alice_member_client.get(
# BASE_PATH,
# params={
# "alias": test_alias,
# "limit": 1,
# "offset": offset,
# },
# )

# connections = response.json()
# assert len(connections) == 1

# record = connections[0]
# assert record not in prev_connections
# prev_connections += (record,)
prev_connections = []
for offset in range(num_connections_to_test):
response = await alice_member_client.get(
BASE_PATH,
params={
"alias": test_alias,
"limit": 1,
"offset": offset,
},
)

connections = response.json()
assert len(connections) == 1

record = connections[0]
assert record not in prev_connections
prev_connections += (record,)

# Test invalid limit and offset values
invalid_params = [
Expand Down
25 changes: 12 additions & 13 deletions app/tests/e2e/test_tenants.py
Original file line number Diff line number Diff line change
Expand Up @@ -918,19 +918,18 @@ async def test_get_wallets_paginated(tenant_admin_client: RichAsyncClient):
assert len(wallets) == 0

# Test fetching unique records with pagination
# TODO: Skipping for now; we require ACA-Py / Askar record ordering to guarantee unique records across pages
# prev_wallets = []
# for offset in range(num_wallets_to_test):
# response = await tenant_admin_client.get(
# f"{TENANTS_BASE_PATH}?limit=1&offset={offset}&group_id={test_group}"
# )

# wallets = response.json()
# assert len(wallets) == 1

# wallet = wallets[0]
# assert wallet not in prev_wallets
# prev_wallets.append(wallet)
prev_wallets = []
for offset in range(num_wallets_to_test):
response = await tenant_admin_client.get(
f"{TENANTS_BASE_PATH}?limit=1&offset={offset}&group_id={test_group}"
)

wallets = response.json()
assert len(wallets) == 1

wallet = wallets[0]
assert wallet not in prev_wallets
prev_wallets.append(wallet)

# Test invalid limit and offset values
invalid_params = [
Expand Down
31 changes: 15 additions & 16 deletions app/tests/e2e/verifier/test_get_records_paginated.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,24 +75,23 @@ async def test_get_presentation_exchange_records_paginated(
assert len(proofs) == 0

# Test fetching unique records with pagination
# TODO: Skipping for now; we require ACA-Py / Askar record ordering to guarantee unique records across pages
# prev_proofs = []
# for offset in range(num_presentation_requests_to_test):
# response = await acme_client.get(
# f"{VERIFIER_BASE_PATH}/proofs",
# params={
# "state": "request-sent",
# "limit": 1,
# "offset": offset,
# },
# )
prev_proofs = []
for offset in range(num_presentation_requests_to_test):