Skip to content

Commit

Permalink
Fix tests that relied on specific Pagination responses (#4015)
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasLaPiana authored Sep 1, 2023
1 parent f72d0dd commit 309b866
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 4 deletions.
1 change: 1 addition & 0 deletions tests/ops/api/v1/endpoints/test_messaging_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,7 @@ def test_get_configs(
}
],
"page": 1,
"pages": 1,
"size": PAGE_SIZE,
"total": 1,
}
Expand Down
2 changes: 2 additions & 0 deletions tests/ops/api/v1/endpoints/test_policy_webhook_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ def test_get_pre_execution_policy_webhooks(
],
"total": 2,
"page": 1,
"pages": 1,
"size": 50,
}

Expand Down Expand Up @@ -174,6 +175,7 @@ def test_get_post_execution_policy_webhooks(
],
"total": 2,
"page": 1,
"pages": 1,
"size": 50,
}

Expand Down
37 changes: 33 additions & 4 deletions tests/ops/api/v1/endpoints/test_privacy_preference_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,13 @@ def test_verify_then_set_privacy_preferences(
)
assert response.status_code == 200
# Assert no existing privacy preferences exist for this identity
assert response.json() == {"items": [], "total": 0, "page": 1, "size": 50}
assert response.json() == {
"items": [],
"total": 0,
"page": 1,
"pages": 0,
"size": 50,
}

response = api_client.patch(
f"{V1_URL_PREFIX}{CONSENT_REQUEST_PRIVACY_PREFERENCES_WITH_ID.format(consent_request_id=consent_request.id)}",
Expand Down Expand Up @@ -244,7 +250,13 @@ def test_verify_then_set_privacy_preferences_but_no_privacy_request_created(
)
assert response.status_code == 200
# Assert no existing privacy preferences exist for this identity
assert response.json() == {"items": [], "total": 0, "page": 1, "size": 50}
assert response.json() == {
"items": [],
"total": 0,
"page": 1,
"pages": 0,
"size": 50,
}

request_body = {
"browser_identity": {"ga_client_id": "test"},
Expand Down Expand Up @@ -880,7 +892,13 @@ def test_verify_then_set_privacy_preferences_with_additional_fides_user_device_i
)
assert response.status_code == 200
# Assert no existing privacy preferences exist for this identity
assert response.json() == {"items": [], "total": 0, "page": 1, "size": 50}
assert response.json() == {
"items": [],
"total": 0,
"page": 1,
"pages": 0,
"size": 50,
}

response = api_client.patch(
f"{V1_URL_PREFIX}{CONSENT_REQUEST_PRIVACY_PREFERENCES_WITH_ID.format(consent_request_id=consent_request.id)}",
Expand Down Expand Up @@ -1055,7 +1073,13 @@ def test_consent_verify_no_privacy_preferences_present(
)
assert response.status_code == 200
assert verification_code in mock_verify_identity.call_args_list[0].args
assert response.json() == {"items": [], "total": 0, "page": 1, "size": 50}
assert response.json() == {
"items": [],
"total": 0,
"page": 1,
"pages": 0,
"size": 50,
}

@pytest.mark.usefixtures(
"subject_identity_verification_required",
Expand Down Expand Up @@ -1452,6 +1476,7 @@ def test_get_historical_preferences(
assert len(response.json()["items"]) == 1
assert response.json()["total"] == 1
assert response.json()["page"] == 1
assert response.json()["pages"] == 1
assert response.json()["size"] == 50

response_body = response.json()["items"][0]
Expand Down Expand Up @@ -1513,6 +1538,7 @@ def test_get_historical_preferences_user_geography_unsupported(
assert len(response.json()["items"]) == 1
assert response.json()["total"] == 1
assert response.json()["page"] == 1
assert response.json()["pages"] == 1
assert response.json()["size"] == 50

response_body = response.json()["items"][0]
Expand All @@ -1538,6 +1564,7 @@ def test_get_historical_preferences_ordering(
assert len(response.json()["items"]) == 3
assert response.json()["total"] == 3
assert response.json()["page"] == 1
assert response.json()["pages"] == 1
assert response.json()["size"] == 50

response_body = response.json()["items"]
Expand Down Expand Up @@ -1667,6 +1694,7 @@ def test_get_current_preferences(
assert len(response.json()["items"]) == 1
assert response.json()["total"] == 1
assert response.json()["page"] == 1
assert response.json()["pages"] == 1
assert response.json()["size"] == 50

response_body = response.json()["items"][0]
Expand Down Expand Up @@ -1698,6 +1726,7 @@ def test_get_current_preference_ordering(
assert len(response.json()["items"]) == 3
assert response.json()["total"] == 3
assert response.json()["page"] == 1
assert response.json()["pages"] == 1
assert response.json()["size"] == 50

response_body = response.json()["items"]
Expand Down
4 changes: 4 additions & 0 deletions tests/ops/api/v1/endpoints/test_privacy_request_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,7 @@ def test_get_privacy_requests_by_id(
],
"total": 1,
"page": 1,
"pages": 1,
"size": page_size,
}

Expand Down Expand Up @@ -773,6 +774,7 @@ def test_get_privacy_requests_by_partial_id(
],
"total": 1,
"page": 1,
"pages": 1,
"size": page_size,
}

Expand Down Expand Up @@ -1238,6 +1240,7 @@ def test_verbose_privacy_requests(
],
"total": 1,
"page": 1,
"pages": 1,
"size": page_size,
}
assert resp == expected_resp
Expand Down Expand Up @@ -1690,6 +1693,7 @@ def test_get_execution_logs(
],
"total": 3,
"page": 1,
"pages": 1,
"size": page_size,
}

Expand Down
2 changes: 2 additions & 0 deletions tests/ops/api/v1/endpoints/test_storage_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@ def test_get_configs(
}
],
"page": 1,
"pages": 1,
"size": PAGE_SIZE,
"total": 1,
}
Expand Down Expand Up @@ -679,6 +680,7 @@ def test_get_default_configs(
}
],
"page": 1,
"pages": 1,
"size": PAGE_SIZE,
"total": 1,
}
Expand Down

0 comments on commit 309b866

Please sign in to comment.