Skip to content

Commit

Permalink
Merge pull request #403 from ral-facilities/fix/remove-dataset-filesize
Browse files Browse the repository at this point in the history
Fix/remove dataset filesize
  • Loading branch information
Reillyhewitson authored Feb 23, 2023
2 parents 4b121d6 + 5dce490 commit d530145
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
),
Expand Down Expand Up @@ -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",
),
Expand All @@ -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",
),
Expand All @@ -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",
),
Expand All @@ -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",
),
Expand All @@ -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",
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
26 changes: 13 additions & 13 deletions test/integration/search_api/endpoints/test_get_dataset_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class TestSearchAPIGetDatasetFilesEndpoint:
"pid, request_filter, expected_json",
[
pytest.param(
"1-4978-6907-2",
"0-449-78690-0",
'{"limit": 2}',
[
{
Expand All @@ -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}',
[
{
Expand All @@ -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"}}',
[
{
Expand All @@ -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"}}}',
[
{
Expand All @@ -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"}]}',
[
{
Expand All @@ -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,
Expand Down
20 changes: 10 additions & 10 deletions test/integration/search_api/endpoints/test_get_entity_by_pid.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -155,7 +155,7 @@ class TestSearchAPIGetByPIDEndpoint:
],
"datasets": [
{
"pid": "1-4978-6907-2",
"pid": "0-449-78690-0",
"title": "DATASET 1",
"isPublic": True,
"size": None,
Expand All @@ -167,7 +167,7 @@ class TestSearchAPIGetByPIDEndpoint:
"samples": [],
},
{
"pid": "0-557-36716-6",
"pid": "1-182-78162-4",
"title": "DATASET 61",
"isPublic": True,
"size": None,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -430,7 +430,7 @@ class TestSearchAPIGetByPIDEndpoint:
],
"datasets": [
{
"pid": "1-4978-6907-2",
"pid": "0-449-78690-0",
"title": "DATASET 1",
"isPublic": True,
"size": None,
Expand All @@ -442,7 +442,7 @@ class TestSearchAPIGetByPIDEndpoint:
"samples": [],
},
{
"pid": "0-557-36716-6",
"pid": "1-182-78162-4",
"title": "DATASET 61",
"isPublic": True,
"size": None,
Expand Down
26 changes: 13 additions & 13 deletions test/integration/search_api/endpoints/test_search_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -27,7 +27,7 @@ class TestSearchAPISearchEndpoint:
"samples": [],
},
{
"pid": "1-01-107043-X",
"pid": "1-07-598386-X",
"title": "DATASET 2",
"isPublic": True,
"size": None,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -171,7 +171,7 @@ class TestSearchAPISearchEndpoint:
],
"datasets": [
{
"pid": "1-4978-6907-2",
"pid": "0-449-78690-0",
"title": "DATASET 1",
"isPublic": True,
"size": None,
Expand All @@ -183,7 +183,7 @@ class TestSearchAPISearchEndpoint:
"samples": [],
},
{
"pid": "0-557-36716-6",
"pid": "1-182-78162-4",
"title": "DATASET 61",
"isPublic": True,
"size": None,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -671,7 +671,7 @@ class TestSearchAPISearchEndpoint:
],
"datasets": [
{
"pid": "1-4978-6907-2",
"pid": "0-449-78690-0",
"title": "DATASET 1",
"isPublic": True,
"size": None,
Expand All @@ -692,7 +692,7 @@ class TestSearchAPISearchEndpoint:
"samples": [],
},
{
"pid": "0-557-36716-6",
"pid": "1-182-78162-4",
"title": "DATASET 61",
"isPublic": True,
"size": None,
Expand Down
1 change: 0 additions & 1 deletion util/icat_db_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,6 @@ def generate_dataset(self, i):
dataset.name = f"{tablename} {i}"
dataset.description = faker.text()
dataset.fileCount = 15
dataset.fileSize = faker.random_int(123, 213123121)
dataset.doi = faker.isbn10(separator="-")
dataset.startDate = get_start_date(i)
dataset.endDate = get_end_date(i)
Expand Down

0 comments on commit d530145

Please sign in to comment.