From 5dce490bad0dfc43036f2ab2c829357650bfee99 Mon Sep 17 00:00:00 2001 From: Reillyhewitson Date: Thu, 23 Feb 2023 14:04:57 +0000 Subject: [PATCH] Fix test differences --- .../db/test_database_filter_utilities.py | 24 ++++++++--------- .../endpoints/test_count_dataset_files.py | 14 +++++----- .../endpoints/test_get_dataset_files.py | 26 +++++++++---------- .../endpoints/test_get_entity_by_pid.py | 20 +++++++------- .../endpoints/test_search_endpoint.py | 26 +++++++++---------- 5 files changed, 55 insertions(+), 55 deletions(-) diff --git a/test/integration/datagateway_api/db/test_database_filter_utilities.py b/test/integration/datagateway_api/db/test_database_filter_utilities.py index a571b7c1..d0ce50a2 100644 --- a/test/integration/datagateway_api/db/test_database_filter_utilities.py +++ b/test/integration/datagateway_api/db/test_database_filter_utilities.py @@ -173,8 +173,8 @@ def test_invalid_get_field(self, flask_test_app_db): "\nMuch team discussion message weight.", "facilityID": 1, "typeID": 3, - "fileSize": 0, - "fileCount": 0, + "fileCount": 30, + "fileSize": 3118779841, }, id="not equal (ne)", ), @@ -213,8 +213,8 @@ def test_invalid_get_field(self, flask_test_app_db): "\nMuch team discussion message weight.", "facilityID": 1, "typeID": 3, - "fileSize": 0, - "fileCount": 0, + "fileSize": 3118779841, + "fileCount": 30, }, id="not like", ), @@ -236,8 +236,8 @@ def test_invalid_get_field(self, flask_test_app_db): "\nMuch team discussion message weight.", "facilityID": 1, "typeID": 3, - "fileSize": 0, - "fileCount": 0, + "fileSize": 3118779841, + "fileCount": 30, }, id="less than", ), @@ -259,8 +259,8 @@ def test_invalid_get_field(self, flask_test_app_db): "\nMuch team discussion message weight.", "facilityID": 1, "typeID": 3, - "fileSize": 0, - "fileCount": 0, + "fileSize": 3118779841, + "fileCount": 30, }, id="less than or equal", ), @@ -280,8 +280,8 @@ def test_invalid_get_field(self, flask_test_app_db): "political. Meeting those voice hand.", "facilityID": 1, "typeID": 1, - "fileSize": 0, - "fileCount": 0, + "fileSize": 3700075351, + "fileCount": 30, }, id="greater than", ), @@ -302,8 +302,8 @@ def test_invalid_get_field(self, flask_test_app_db): "political. Meeting those voice hand.", "facilityID": 1, "typeID": 1, - "fileSize": 0, - "fileCount": 0, + "fileSize": 3700075351, + "fileCount": 30, }, id="greater than or equal", ), 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 7344d096..c96a6e87 100644 --- a/test/integration/search_api/endpoints/test_count_dataset_files.py +++ b/test/integration/search_api/endpoints/test_count_dataset_files.py @@ -16,25 +16,25 @@ class TestSearchAPICountDatasetFilesEndpoint: marks=pytest.mark.skip, ), pytest.param( - "1-4978-6907-2", - '{"name": "Datafile 1547"}', + "0-449-78690-0", + '{"name": "Datafile 1071"}', {"count": 1}, id="Count dataset files with name condition", ), pytest.param( - "1-4978-6907-2", + "0-449-78690-0", '{"name": {"nlike": "Datafile 9"}}', {"count": 14}, id="Count dataset files with name condition (operator specified)", ), pytest.param( - "1-4978-6907-2", - '{"size": {"gt": 500}}', - {"count": 15}, + "0-449-78690-0", + '{"size": {"gt": 155061161}}', + {"count": 3}, id="Count dataset files with size condition", ), pytest.param( - "1-4978-6907-2", + "0-449-78690-0", '{"name": "Unknown Datafile"}', {"count": 0}, id="Count dataset files with filter to return zero count", 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 c30ead45..2938570d 100644 --- a/test/integration/search_api/endpoints/test_get_dataset_files.py +++ b/test/integration/search_api/endpoints/test_get_dataset_files.py @@ -37,7 +37,7 @@ class TestSearchAPIGetDatasetFilesEndpoint: "pid, request_filter, expected_json", [ pytest.param( - "1-4978-6907-2", + "0-449-78690-0", '{"limit": 2}', [ { @@ -58,7 +58,7 @@ class TestSearchAPIGetDatasetFilesEndpoint: id="Basic /datasets/{pid}/files request", ), pytest.param( - "1-4978-6907-2", + "0-449-78690-0", '{"limit": 1, "skip": 5}', [ { @@ -72,7 +72,7 @@ class TestSearchAPIGetDatasetFilesEndpoint: id="Get dataset files with skip", ), pytest.param( - "1-4978-6907-2", + "0-449-78690-0", '{"limit": 1, "where": {"name": "Datafile 1547"}}', [ { @@ -86,7 +86,7 @@ class TestSearchAPIGetDatasetFilesEndpoint: id="Get dataset files with name condition", ), pytest.param( - "1-4978-6907-2", + "0-449-78690-0", '{"limit": 1, "where": {"name": {"nilike": "Datafile 10060"}}}', [ { @@ -100,27 +100,27 @@ class TestSearchAPIGetDatasetFilesEndpoint: id="Get dataset files with name condition (operator specified)", ), pytest.param( - "1-4978-6907-2", - '{"limit": 1, "where": {"size": {"gt": 5000000}}}', + "0-449-78690-0", + '{"limit": 1, "where": {"size": {"gt": 155061161}}}', [ { - "id": "1071", - "name": "Datafile 1071", - "path": "/sense/through/candidate.jpeg", - "size": 9390543, + "id": "1309", + "name": "Datafile 1309", + "path": "/writer/family/pull.bmp", + "size": 171717920, "dataset": None, }, ], id="Get dataset files with size condition", ), pytest.param( - "1-4978-6907-2", + "0-449-78690-0", '{"limit": 1, "where": {"size": {"gt": 50000000000}}}', [], id="Get dataset files with condition to return empty list", ), pytest.param( - "1-4978-6907-2", + "0-449-78690-0", '{"limit": 1, "include": [{"relation": "dataset"}]}', [ { @@ -129,7 +129,7 @@ class TestSearchAPIGetDatasetFilesEndpoint: "path": "/sense/through/candidate.jpeg", "size": 9390543, "dataset": { - "pid": "1-4978-6907-2", + "pid": "0-449-78690-0", "title": "DATASET 1", "isPublic": True, "size": None, 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 7f12b047..cf6983b6 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 @@ -12,10 +12,10 @@ class TestSearchAPIGetByPIDEndpoint: [ pytest.param( "datasets", - "1-4978-6907-2", + "0-449-78690-0", "{}", { - "pid": "1-4978-6907-2", + "pid": "0-449-78690-0", "title": "DATASET 1", "isPublic": True, "size": None, @@ -77,10 +77,10 @@ class TestSearchAPIGetByPIDEndpoint: ), pytest.param( "datasets", - "1-4978-6907-2", + "0-449-78690-0", '{"include": [{"relation": "documents"}]}', { - "pid": "1-4978-6907-2", + "pid": "0-449-78690-0", "title": "DATASET 1", "isPublic": True, "size": None, @@ -155,7 +155,7 @@ class TestSearchAPIGetByPIDEndpoint: ], "datasets": [ { - "pid": "1-4978-6907-2", + "pid": "0-449-78690-0", "title": "DATASET 1", "isPublic": True, "size": None, @@ -167,7 +167,7 @@ class TestSearchAPIGetByPIDEndpoint: "samples": [], }, { - "pid": "0-557-36716-6", + "pid": "1-182-78162-4", "title": "DATASET 61", "isPublic": True, "size": None, @@ -211,12 +211,12 @@ class TestSearchAPIGetByPIDEndpoint: ), pytest.param( "datasets", - "1-4978-6907-2", + "0-449-78690-0", '{"include": [{"relation": "documents"},' ' {"relation": "files"}, {"relation": "parameters"},' ' {"relation": "samples"}]}', { - "pid": "1-4978-6907-2", + "pid": "0-449-78690-0", "title": "DATASET 1", "isPublic": True, "size": None, @@ -430,7 +430,7 @@ class TestSearchAPIGetByPIDEndpoint: ], "datasets": [ { - "pid": "1-4978-6907-2", + "pid": "0-449-78690-0", "title": "DATASET 1", "isPublic": True, "size": None, @@ -442,7 +442,7 @@ class TestSearchAPIGetByPIDEndpoint: "samples": [], }, { - "pid": "0-557-36716-6", + "pid": "1-182-78162-4", "title": "DATASET 61", "isPublic": True, "size": None, diff --git a/test/integration/search_api/endpoints/test_search_endpoint.py b/test/integration/search_api/endpoints/test_search_endpoint.py index c056e5f0..04969ea1 100644 --- a/test/integration/search_api/endpoints/test_search_endpoint.py +++ b/test/integration/search_api/endpoints/test_search_endpoint.py @@ -15,7 +15,7 @@ class TestSearchAPISearchEndpoint: '{"limit": 2}', [ { - "pid": "1-4978-6907-2", + "pid": "0-449-78690-0", "title": "DATASET 1", "isPublic": True, "size": None, @@ -27,7 +27,7 @@ class TestSearchAPISearchEndpoint: "samples": [], }, { - "pid": "1-01-107043-X", + "pid": "1-07-598386-X", "title": "DATASET 2", "isPublic": True, "size": None, @@ -82,7 +82,7 @@ class TestSearchAPISearchEndpoint: '{"limit": 1, "skip": 5}', [ { - "pid": "1-77218-518-3", + "pid": "0-614-81100-7", "title": "DATASET 6", "isPublic": True, "size": None, @@ -115,7 +115,7 @@ class TestSearchAPISearchEndpoint: ' "2007-06-30T08:30:58.000Z"}}}', [ { - "pid": "1-4978-6907-2", + "pid": "0-449-78690-0", "title": "DATASET 1", "isPublic": True, "size": None, @@ -171,7 +171,7 @@ class TestSearchAPISearchEndpoint: ], "datasets": [ { - "pid": "1-4978-6907-2", + "pid": "0-449-78690-0", "title": "DATASET 1", "isPublic": True, "size": None, @@ -183,7 +183,7 @@ class TestSearchAPISearchEndpoint: "samples": [], }, { - "pid": "0-557-36716-6", + "pid": "1-182-78162-4", "title": "DATASET 61", "isPublic": True, "size": None, @@ -247,7 +247,7 @@ class TestSearchAPISearchEndpoint: '{"where":{"isPublic": {"eq": "True"}}, "limit": 1}', [ { - "pid": "1-4978-6907-2", + "pid": "0-449-78690-0", "title": "DATASET 1", "isPublic": True, "size": None, @@ -284,7 +284,7 @@ class TestSearchAPISearchEndpoint: '{"unit": "unit 1"}]}}}]}', [ { - "pid": "1-85271-859-5", + "pid": "0-490-31235-7", "title": "DATASET 33", "isPublic": True, "size": None, @@ -331,7 +331,7 @@ class TestSearchAPISearchEndpoint: ' "unit 39"}]}}}]}', [ { - "pid": "1-71395-013-8", + "pid": "1-351-03363-8", "title": "DATASET 71", "isPublic": True, "size": None, @@ -370,7 +370,7 @@ class TestSearchAPISearchEndpoint: '"name": "PARAMETERTYPE 39"}, {"value": 44}]}]}}}]}', [ { - "pid": "1-71395-013-8", + "pid": "1-351-03363-8", "title": "DATASET 71", "isPublic": True, "size": None, @@ -408,7 +408,7 @@ class TestSearchAPISearchEndpoint: ' "Datafile 25"}}}], "limit": 1}', [ { - "pid": "1-85150-280-7", + "pid": "0-87851-502-X", "title": "DATASET 13", "isPublic": True, "size": None, @@ -671,7 +671,7 @@ class TestSearchAPISearchEndpoint: ], "datasets": [ { - "pid": "1-4978-6907-2", + "pid": "0-449-78690-0", "title": "DATASET 1", "isPublic": True, "size": None, @@ -692,7 +692,7 @@ class TestSearchAPISearchEndpoint: "samples": [], }, { - "pid": "0-557-36716-6", + "pid": "1-182-78162-4", "title": "DATASET 61", "isPublic": True, "size": None,