diff --git a/test/search_api/endpoints/test_count_dataset_files.py b/test/search_api/endpoints/test_count_dataset_files.py index 1f475fa6..b48e1c20 100644 --- a/test/search_api/endpoints/test_count_dataset_files.py +++ b/test/search_api/endpoints/test_count_dataset_files.py @@ -37,9 +37,6 @@ class TestSearchAPICountDatasetFilesEndpoint: {"count": 0}, id="Count dataset files with filter to return zero count", ), - pytest.param( - "unknown pid", "{}", {"count": 0}, id="Non-existent dataset pid", - ), ], ) def test_valid_count_dataset_files_endpoint( @@ -54,22 +51,24 @@ def test_valid_count_dataset_files_endpoint( assert test_response.json == expected_json @pytest.mark.parametrize( - "pid, request_filter", + "pid, request_filter, expected_status_code", [ - pytest.param("0-8401-1070-7", '{"bad filter"}', id="Bad filter"), + pytest.param("0-8401-1070-7", '{"bad filter"}', 400, id="Bad filter"), pytest.param( "0-8401-1070-7", '{"where": {"name": "FILE 4"}}', + 400, id="Where filter inside where query param", ), + pytest.param("my 404 test pid", "{}", 404, id="Non-existent dataset pid"), ], ) def test_invalid_count_dataset_files_endpoint( - self, flask_test_app_search_api, pid, request_filter, + self, flask_test_app_search_api, pid, request_filter, expected_status_code, ): test_response = flask_test_app_search_api.get( f"{Config.config.search_api.extension}/datasets/{pid}/files/count" f"?where={request_filter}", ) - assert test_response.status_code == 400 + assert test_response.status_code == expected_status_code