Skip to content

Commit

Permalink
test: fix tests following the changes to endpoint URLs #398
Browse files Browse the repository at this point in the history
  • Loading branch information
VKTB committed Feb 14, 2023
1 parent 1dc815b commit 5be35cd
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class TestSearchAPICountDatasetFilesEndpoint:
"0-8401-1070-7",
"{}",
{"count": 56},
id="Basic /datasets/{pid}/files/count request",
id="Basic /Datasets/{pid}/files/count request",
# Skipped because empty dict for filter doesn't work on where
marks=pytest.mark.skip,
),
Expand Down Expand Up @@ -54,7 +54,7 @@ def test_valid_count_dataset_files_endpoint(
):

test_response = flask_test_app_search_api.get(
f"{Config.config.search_api.extension}/datasets/{pid}/files/count"
f"{Config.config.search_api.extension}/Datasets/{pid}/files/count"
f"?where={request_filter}",
)

Expand All @@ -76,7 +76,7 @@ def test_invalid_count_dataset_files_endpoint(
self, flask_test_app_search_api, pid, request_filter,
):
test_response = flask_test_app_search_api.get(
f"{Config.config.search_api.extension}/datasets/{pid}/files/count"
f"{Config.config.search_api.extension}/Datasets/{pid}/files/count"
f"?where={request_filter}",
)

Expand Down
36 changes: 18 additions & 18 deletions test/integration/search_api/endpoints/test_count_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,67 +8,67 @@ class TestSearchAPICountEndpoint:
"endpoint_name, request_filter, expected_json",
[
pytest.param(
"datasets",
"Datasets",
"{}",
{"count": 479},
id="Basic /datasets/count request",
id="Basic /Datasets/count request",
# Skipped because empty dict for filter doesn't work on where
marks=pytest.mark.skip,
),
pytest.param(
"documents",
"Documents",
"{}",
{"count": 239},
id="Basic /documents/count request",
id="Basic /Documents/count request",
# Skipped because empty dict for filter doesn't work on where
marks=pytest.mark.skip,
),
pytest.param(
"instruments",
"Instruments",
"{}",
{"count": 14},
id="Basic /instruments/count request",
id="Basic /Instruments/count request",
# Skipped because empty dict for filter doesn't work on where
marks=pytest.mark.skip,
),
pytest.param(
"datasets",
"Datasets",
'{"title": "DATASET 30"}',
{"count": 1},
id="Dataset count with basic where",
),
pytest.param(
"documents",
"Documents",
'{"title": "INVESTIGATION 2"}',
{"count": 1},
id="Document count with basic where",
),
pytest.param(
"instruments",
"Instruments",
'{"name": "INSTRUMENT 12"}',
{"count": 1},
id="Instrument count with basic where",
),
pytest.param(
"datasets",
"Datasets",
'{"title": {"like": "DATASET 30"}}',
{"count": 11},
id="Dataset count with where (operator specified)",
),
pytest.param(
"documents",
"Documents",
'{"summary": {"ilike": "nature"}}',
{"count": 7},
id="Document count with where (operator specified)",
),
pytest.param(
"instruments",
"Instruments",
'{"name": {"nilike": "INSTRUMENT 5"}}',
{"count": 13},
id="Instrument count with where (operator specified)",
),
pytest.param(
"instruments",
"Instruments",
'{"facility": {"like": "LILS"}}',
{"count": 14},
id="Instrument count with where using related ICAT mapping",
Expand All @@ -90,27 +90,27 @@ def test_valid_count_endpoint(
"endpoint_name, request_filter, expected_json",
[
pytest.param(
"datasets",
"Datasets",
'{"isPublic": true}',
{"count": 479},
id="Dataset count with isPublic condition (True)",
),
pytest.param(
"documents",
"Documents",
'{"isPublic": true}',
{"count": 239},
id="Document count with isPublic condition (True)",
),
pytest.param(
"datasets",
"Datasets",
'{"isPublic": false}',
{"count": 0},
id="Dataset count with isPublic condition (False)",
# Skipped due to skip filter causing issue on count endpoints
marks=pytest.mark.skip,
),
pytest.param(
"documents",
"Documents",
'{"isPublic": false}',
{"count": 0},
id="Document count with isPublic condition (False)",
Expand Down Expand Up @@ -144,7 +144,7 @@ def test_invalid_count_endpoint(
self, flask_test_app_search_api, request_filter,
):
test_response = flask_test_app_search_api.get(
f"{Config.config.search_api.extension}/datasets/count"
f"{Config.config.search_api.extension}/Datasets/count"
f"?where={request_filter}",
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class TestSearchAPIGetDatasetFilesEndpoint:
"dataset": None,
},
],
id="Basic /datasets/{pid}/files request",
id="Basic /Datasets/{pid}/files request",
),
pytest.param(
"0-8401-1070-7",
Expand Down Expand Up @@ -122,7 +122,7 @@ def test_valid_get_dataset_files_endpoint(
self, flask_test_app_search_api, pid, request_filter, expected_json,
):
test_response = flask_test_app_search_api.get(
f"{Config.config.search_api.extension}/datasets/{pid}/files"
f"{Config.config.search_api.extension}/Datasets/{pid}/files"
f"?filter={request_filter}",
)

Expand Down Expand Up @@ -155,7 +155,7 @@ def test_invalid_get_dataset_files_endpoint(
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"
f"{Config.config.search_api.extension}/Datasets/{pid}/files"
f"?filter={request_filter}",
)

Expand Down
26 changes: 13 additions & 13 deletions test/integration/search_api/endpoints/test_get_entity_by_pid.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class TestSearchAPIGetByPIDEndpoint:
"endpoint_name, pid, request_filter, expected_json",
[
pytest.param(
"datasets",
"Datasets",
"0-8401-1070-7",
"{}",
{
Expand All @@ -24,10 +24,10 @@ class TestSearchAPIGetByPIDEndpoint:
"parameters": [],
"samples": [],
},
id="Basic /datasets/{pid} request",
id="Basic /Datasets/{pid} request",
),
pytest.param(
"documents",
"Documents",
"0-449-78690-0",
"{}",
{
Expand Down Expand Up @@ -126,10 +126,10 @@ class TestSearchAPIGetByPIDEndpoint:
"members": [],
"parameters": [],
},
id="Basic /documents/{pid} request",
id="Basic /Documents/{pid} request",
),
pytest.param(
"instruments",
"Instruments",
"pid:2",
"{}",
{
Expand All @@ -138,10 +138,10 @@ class TestSearchAPIGetByPIDEndpoint:
"facility": "LILS",
"datasets": [],
},
id="Basic /instruments/{pid} request",
id="Basic /Instruments/{pid} request",
),
pytest.param(
"datasets",
"Datasets",
"0-8401-1070-7",
'{"include": [{"relation": "documents"}]}',
{
Expand Down Expand Up @@ -251,7 +251,7 @@ class TestSearchAPIGetByPIDEndpoint:
id="Get dataset by pid with include filter",
),
pytest.param(
"documents",
"Documents",
"0-449-78690-0",
'{"include": [{"relation": "datasets"}]}',
{
Expand Down Expand Up @@ -380,7 +380,7 @@ class TestSearchAPIGetByPIDEndpoint:
id="Get document by pid with include filter",
),
pytest.param(
"instruments",
"Instruments",
"2",
'{"include": [{"relation": "datasets"}]}',
{
Expand All @@ -405,7 +405,7 @@ class TestSearchAPIGetByPIDEndpoint:
marks=pytest.mark.skip,
),
pytest.param(
"datasets",
"Datasets",
"0-8401-1070-7",
'{"include": [{"relation": "documents"},'
' {"relation": "files"}, {"relation": "parameters"},'
Expand Down Expand Up @@ -920,7 +920,7 @@ class TestSearchAPIGetByPIDEndpoint:
id="Get dataset by pid including all ICAT 4 related entities",
),
pytest.param(
"datasets",
"Datasets",
"0-8401-1070-7",
'{"include": [{"relation": "documents"}, {"relation": "techniques"},'
' {"relation": "instrument"}, {"relation": "files"},'
Expand All @@ -931,7 +931,7 @@ class TestSearchAPIGetByPIDEndpoint:
marks=pytest.mark.skip,
),
pytest.param(
"documents",
"Documents",
"0-449-78690-0",
'{"include": [{"relation": "datasets"}, {"relation": "members"},'
' {"relation": "parameters"}]}',
Expand Down Expand Up @@ -1111,7 +1111,7 @@ def test_invalid_get_by_pid_endpoint(
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}"
f"{Config.config.search_api.extension}/Datasets/{pid}"
f"?filter={request_filter}",
)

Expand Down
Loading

0 comments on commit 5be35cd

Please sign in to comment.