diff --git a/test/integration/search_api/endpoints/test_count_dataset_files.py b/test/integration/search_api/endpoints/test_count_dataset_files.py index 117d6a42..21efe04b 100644 --- a/test/integration/search_api/endpoints/test_count_dataset_files.py +++ b/test/integration/search_api/endpoints/test_count_dataset_files.py @@ -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, ), @@ -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}", ) @@ -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}", ) diff --git a/test/integration/search_api/endpoints/test_count_endpoint.py b/test/integration/search_api/endpoints/test_count_endpoint.py index b9dddcb1..64279808 100644 --- a/test/integration/search_api/endpoints/test_count_endpoint.py +++ b/test/integration/search_api/endpoints/test_count_endpoint.py @@ -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", @@ -90,19 +90,19 @@ 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)", @@ -110,7 +110,7 @@ def test_valid_count_endpoint( marks=pytest.mark.skip, ), pytest.param( - "documents", + "Documents", '{"isPublic": false}', {"count": 0}, id="Document count with isPublic condition (False)", @@ -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}", ) diff --git a/test/integration/search_api/endpoints/test_get_dataset_files.py b/test/integration/search_api/endpoints/test_get_dataset_files.py index 91f2b784..3ce6d364 100644 --- a/test/integration/search_api/endpoints/test_get_dataset_files.py +++ b/test/integration/search_api/endpoints/test_get_dataset_files.py @@ -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", @@ -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}", ) @@ -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}", ) diff --git a/test/integration/search_api/endpoints/test_get_entity_by_pid.py b/test/integration/search_api/endpoints/test_get_entity_by_pid.py index cfe6264d..63163088 100644 --- a/test/integration/search_api/endpoints/test_get_entity_by_pid.py +++ b/test/integration/search_api/endpoints/test_get_entity_by_pid.py @@ -8,7 +8,7 @@ class TestSearchAPIGetByPIDEndpoint: "endpoint_name, pid, request_filter, expected_json", [ pytest.param( - "datasets", + "Datasets", "0-8401-1070-7", "{}", { @@ -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", "{}", { @@ -126,10 +126,10 @@ class TestSearchAPIGetByPIDEndpoint: "members": [], "parameters": [], }, - id="Basic /documents/{pid} request", + id="Basic /Documents/{pid} request", ), pytest.param( - "instruments", + "Instruments", "pid:2", "{}", { @@ -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"}]}', { @@ -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"}]}', { @@ -380,7 +380,7 @@ class TestSearchAPIGetByPIDEndpoint: id="Get document by pid with include filter", ), pytest.param( - "instruments", + "Instruments", "2", '{"include": [{"relation": "datasets"}]}', { @@ -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"},' @@ -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"},' @@ -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"}]}', @@ -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}", ) diff --git a/test/integration/search_api/endpoints/test_search_endpoint.py b/test/integration/search_api/endpoints/test_search_endpoint.py index f06b2681..097a46a1 100644 --- a/test/integration/search_api/endpoints/test_search_endpoint.py +++ b/test/integration/search_api/endpoints/test_search_endpoint.py @@ -8,7 +8,7 @@ class TestSearchAPISearchEndpoint: "endpoint_name, request_filter, expected_json", [ pytest.param( - "datasets", + "Datasets", '{"limit": 2}', [ { @@ -38,10 +38,10 @@ class TestSearchAPISearchEndpoint: "samples": [], }, ], - id="Basic /datasets request", + id="Basic /Datasets request", ), pytest.param( - "documents", + "Documents", '{"limit": 1}', [ { @@ -141,10 +141,10 @@ class TestSearchAPISearchEndpoint: "parameters": [], }, ], - id="Basic /documents request", + id="Basic /Documents request", ), pytest.param( - "instruments", + "Instruments", '{"limit": 2}', [ { @@ -160,10 +160,10 @@ class TestSearchAPISearchEndpoint: "pid": "pid:2", }, ], - id="Basic /instruments request", + id="Basic /Instruments request", ), pytest.param( - "datasets", + "Datasets", '{"limit": 1, "skip": 5}', [ { @@ -183,7 +183,7 @@ class TestSearchAPISearchEndpoint: id="Search datasets with skip filter", ), pytest.param( - "instruments", + "Instruments", '{"limit": 2, "where": {"name": "INSTRUMENT 10"}}', [ { @@ -196,7 +196,7 @@ class TestSearchAPISearchEndpoint: id="Search instruments with name condition", ), pytest.param( - "datasets", + "Datasets", '{"limit": 1, "where": {"creationDate": {"gt":' ' "2007-06-30T08:30:58.000Z"}}}', [ @@ -217,7 +217,7 @@ class TestSearchAPISearchEndpoint: id="Search datasets with creation date filter (operator specified)", ), pytest.param( - "datasets", + "Datasets", '{"include": [{"relation": "documents"}, {"relation": "techniques"},' ' {"relation": "instrument"}, {"relation": "files"},' ' {"relation": "parameters"}, {"relation": "samples"}], "limit": 1}', @@ -227,7 +227,7 @@ class TestSearchAPISearchEndpoint: marks=pytest.mark.skip, ), pytest.param( - "documents", + "Documents", '{"include": [{"relation": "datasets"}, {"relation": "members"},' ' {"relation": "parameters"}], "limit": 1}', [ @@ -375,7 +375,7 @@ class TestSearchAPISearchEndpoint: id="Search documents including all possible related entities", ), pytest.param( - "instruments", + "Instruments", '{"include": [{"relation": "datasets"}], "limit": 1}', { "description": "Former outside source play nearly Congress before" @@ -399,7 +399,7 @@ class TestSearchAPISearchEndpoint: marks=pytest.mark.skip, ), pytest.param( - "datasets", + "Datasets", '{"limit": 1, "where": {"isPublic": true}}', [ { @@ -419,13 +419,13 @@ class TestSearchAPISearchEndpoint: id="Search datasets with isPublic condition (True)", ), pytest.param( - "datasets", + "Datasets", '{"where": {"isPublic": false}}', [], id="Search datasets with isPublic condition (False)", ), pytest.param( - "datasets", + "Datasets", '{"include": [{"relation": "techniques", "scope": {"where": {"name":' '"TODO"}}}]}', [], @@ -435,7 +435,7 @@ class TestSearchAPISearchEndpoint: id="Search datasets with condition on techniques name (ICAT 5)", ), pytest.param( - "datasets", + "Datasets", '{"include": [{"relation": "parameters", "scope": {"where": {"and": [{' '"name": "PARAMETERTYPE 39"}, {"value": {"between": [320300, 320320]}},' '{"unit": "unit 39"}]}}}]}', @@ -467,7 +467,7 @@ class TestSearchAPISearchEndpoint: " operator, A AND B AND C)", ), pytest.param( - "datasets", + "Datasets", '{"include": [{"relation": "parameters", "scope": {"where": {"and": [{' '"name": "PARAMETERTYPE 39"}, {"value": {"lt": 800000}}, {"unit":' ' "unit 39"}]}}}]}', @@ -499,7 +499,7 @@ class TestSearchAPISearchEndpoint: ", A AND B AND C)", ), pytest.param( - "datasets", + "Datasets", '{"include": [{"relation": "parameters", "scope": {"where": {"or": [{' '"and": [{"name": "sample_state"}, {"value": "solid"}]}, {"and": [{' '"name": "PARAMETERTYPE 39"}, {"value": 320310}]}]}}}]}', @@ -531,7 +531,7 @@ class TestSearchAPISearchEndpoint: " OR (C AND D)", ), pytest.param( - "datasets", + "Datasets", '{"include": [{"relation": "files", "scope": {"where": {"text":' ' "Datafile 10064"}}}]}', [ @@ -945,7 +945,7 @@ class TestSearchAPISearchEndpoint: id="Search datasets' files using full text search", ), pytest.param( - "documents", + "Documents", '{"where": {"type": "INVESTIGATIONTYPE 2"}, "include": [{"relation":' '"datasets"}, {"relation": "members", "scope": {"where": {"role": "PI"' '}, "include": [{"relation": "person", "scope": {"where": {"fullName":' @@ -1051,7 +1051,7 @@ class TestSearchAPISearchEndpoint: " conditions", ), pytest.param( - "documents", + "Documents", '{"include": [{"relation": "parameters", "scope": {"where": {"and": [{' '"name": "PARAMETERTYPE 27"}, {"value": {"between": [127260, 127270]}},' '{"unit": "unit 27"}]}}}]}', @@ -1166,7 +1166,7 @@ class TestSearchAPISearchEndpoint: " operator, A AND B AND C)", ), pytest.param( - "documents", + "Documents", '{"include": [{"relation": "datasets", "scope": {"include": [{' '"relation": "parameters", "scope": {"where": {"and": [{"name":' ' "PARAMETERTYPE 27"}, {"value": {"between": [177670, 177680]}}, {' @@ -1296,7 +1296,7 @@ class TestSearchAPISearchEndpoint: " (between operator, A AND B AND C)", ), pytest.param( - "datasets", + "Datasets", '{"include": [{"relation": "datasets", "scope": {"include": [{' '"relation": "samples", "scope": {"where": {"name": "SAMPLE 4"}}}, {' '"relation": "techniques", "scope": {"where": {"name": "TODO"}}}]}}]}', @@ -1422,7 +1422,7 @@ class TestSearchAPISearchEndpoint: id="Search documents with multiple include and scopes (ICAT 5)", ), pytest.param( - "documents", + "Documents", '{"filter": {"query": "TODO"}}', [], # Skipped because this test relies the search scoring component @@ -1455,7 +1455,7 @@ def test_invalid_search_endpoint( self, flask_test_app_search_api, request_filter, expected_status_code, ): test_response = flask_test_app_search_api.get( - f"{Config.config.search_api.extension}/instruments?filter={request_filter}", + f"{Config.config.search_api.extension}/Instruments?filter={request_filter}", ) assert test_response.status_code == expected_status_code diff --git a/test/integration/test_endpoint_rules.py b/test/integration/test_endpoint_rules.py index cc439545..39afab27 100644 --- a/test/integration/test_endpoint_rules.py +++ b/test/integration/test_endpoint_rules.py @@ -70,57 +70,57 @@ def test_entity_endpoints(self, flask_test_app, endpoint_ending, expected_method id="count ISIS investigations", ), pytest.param( - f"{Config.config.search_api.extension}/datasets", + f"{Config.config.search_api.extension}/Datasets", ["GET"], id="Search API search datasets", ), pytest.param( - f"{Config.config.search_api.extension}/documents", + f"{Config.config.search_api.extension}/Documents", ["GET"], id="Search API search documents", ), pytest.param( - f"{Config.config.search_api.extension}/instruments", + f"{Config.config.search_api.extension}/Instruments", ["GET"], id="Search API search instruments", ), pytest.param( - f"{Config.config.search_api.extension}/datasets/", + f"{Config.config.search_api.extension}/Datasets/", ["GET"], id="Search API get single dataset", ), pytest.param( - f"{Config.config.search_api.extension}/documents/", + f"{Config.config.search_api.extension}/Documents/", ["GET"], id="Search API get single document", ), pytest.param( - f"{Config.config.search_api.extension}/instruments/", + f"{Config.config.search_api.extension}/Instruments/", ["GET"], id="Search API get single instrument", ), pytest.param( - f"{Config.config.search_api.extension}/datasets/count", + f"{Config.config.search_api.extension}/Datasets/count", ["GET"], id="Search API dataset count", ), pytest.param( - f"{Config.config.search_api.extension}/documents/count", + f"{Config.config.search_api.extension}/Documents/count", ["GET"], id="Search API document count", ), pytest.param( - f"{Config.config.search_api.extension}/instruments/count", + f"{Config.config.search_api.extension}/Instruments/count", ["GET"], id="Search API instrument count", ), pytest.param( - f"{Config.config.search_api.extension}/datasets//files", + f"{Config.config.search_api.extension}/Datasets//files", ["GET"], id="Search API get dataset files", ), pytest.param( - f"{Config.config.search_api.extension}/datasets//files" + f"{Config.config.search_api.extension}/Datasets//files" "/count", ["GET"], id="Search API dataset files count",