Skip to content

Commit

Permalink
Add test for checking invalid uuids in related/
Browse files Browse the repository at this point in the history
  • Loading branch information
Krystle Salazar committed Dec 12, 2024
1 parent d15b0cb commit e6eaa49
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion api/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ generate-docs doc="media-props" fail_on_diff="true":

# Run API tests inside the Docker container
[positional-arguments]
test *args: wait-up
test *args:
env DC_USER="ov_user" just ../exec web pytest "$@"

# Run API tests locally
Expand Down
17 changes: 17 additions & 0 deletions api/test/integration/test_media_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ def test_search_refuses_invalid_categories(
@pytest.mark.parametrize(
"bad_uuid",
[
"000000000000000000000000000000000000",
"123456789123456789123456789123456789",
"12345678-1234-5678-1234-1234567891234",
"abcd",
Expand Down Expand Up @@ -383,6 +384,22 @@ def test_detail_view_contains_sensitivity_info(sensitive_result, api_client):
################


@pytest.mark.parametrize(
"bad_uuid",
[
"000000000000000000000000000000000000",
"123456789123456789123456789123456789",
"12345678-1234-5678-1234-1234567891234",
"abcd",
],
)
def test_related_view_for_invalid_uuids_returns_not_found(
media_type_config: MediaTypeConfig, bad_uuid: str, api_client
):
res = api_client.get(f"/v1/{media_type_config.url_prefix}/{bad_uuid}/related/")
assert res.status_code == 404


def test_related_view_has_no_pagination(related_results):
_, _, data = related_results
results = data["results"]
Expand Down

0 comments on commit e6eaa49

Please sign in to comment.