diff --git a/test/search_api/endpoints/test_get_entity_by_pid.py b/test/search_api/endpoints/test_get_entity_by_pid.py index d2cea61d..de12c7fc 100644 --- a/test/search_api/endpoints/test_get_entity_by_pid.py +++ b/test/search_api/endpoints/test_get_entity_by_pid.py @@ -12,20 +12,17 @@ class TestSearchAPIGetByPIDEndpoint: "0-8401-1070-7", "{}", { - "description": "Beat professional blue clear style have. Light" - " final summer. Or hour color maybe word side much team.\nMessage" - " weight official learn especially nature. Himself tax west.", - "modTime": "2006-08-24 01:28:06+00:00", - "modId": "user", - "startDate": "2000-10-13 00:00:00+00:00", - "endDate": "2000-02-10 00:00:00+00:00", - "createId": "user", - "complete": True, - "id": 2, - "name": "DATASET 2", - "doi": "0-8401-1070-7", - "createTime": "2013-04-01 10:56:52+00:00", - "location": "/subject/break.jpeg", + "pid": "0-8401-1070-7", + "title": "DATASET 2", + "isPublic": True, + "creationDate": "2013-04-01T10:56:52+00:00", + "size": None, + "documents": [], + "techniques": [], + "instrument": None, + "files": [], + "parameters": [], + "samples": [], }, id="Basic /datasets/{pid} request", ), @@ -34,22 +31,100 @@ class TestSearchAPIGetByPIDEndpoint: "0-449-78690-0", "{}", { - "visitId": "42", - "modId": "user", - "name": "INVESTIGATION 1", - "createId": "user", - "createTime": "2002-11-27 06:20:36+00:00", - "doi": "0-449-78690-0", - "id": 1, + "pid": "0-449-78690-0", + "isPublic": True, + "type": "INVESTIGATIONTYPE 2", + "title": "INVESTIGATION 1", "summary": "Season identify professor happen third. Beat" " professional blue clear style have. Light final summer.", - "endDate": "2000-07-09 00:00:00+00:00", - "modTime": "2005-04-30 19:41:49+00:00", - "releaseDate": "2000-07-05 00:00:00+00:00", - "startDate": "2000-04-03 00:00:00+00:00", - "title": "Including spend increase ability music skill former." - " Agreement director concern once technology sometimes someone" - " staff.\nSuccess pull bar. Laugh senior example.", + "doi": "0-449-78690-0", + "startDate": "2000-04-03T00:00:00+00:00", + "endDate": "2000-07-09T00:00:00+00:00", + "releaseDate": "2000-07-05T00:00:00+00:00", + "license": None, + "keywords": [ + "read123", + "boy129", + "out253", + "hour326", + "possible449", + "west566", + "scene948", + "who1253", + "capital1526", + "dream1989", + "front2347", + "inside2465", + "surface2851", + "learn2953", + "hot3053", + "just3159", + "population3261", + "cup3366", + "another3451", + "environmental3632", + "require3858", + "rock3952", + "determine4048", + "space4061", + "big4229", + "why4243", + "public4362", + "election4641", + "measure4996", + "often5014", + "develop5135", + "than5310", + "floor5312", + "check5327", + "cost5487", + "information6130", + "guy6180", + "admit6235", + "market6645", + "law6777", + "close7336", + "billion7597", + "product7964", + "American8041", + "language8246", + "school8277", + "specific8539", + "position8670", + "grow8702", + "time8899", + "weight9086", + "catch9129", + "speak9559", + "strong9621", + "development9757", + "best9786", + "identify10039", + "give10497", + "life10854", + "century11040", + "fire11580", + "leg11744", + "past11935", + "bar12034", + "do12108", + "prove12224", + "body12251", + "data12288", + "at12640", + "star12706", + "customer12795", + "small13058", + "event13141", + "now13193", + "magazine13415", + "policy13601", + "black13996", + "American14654", + ], + "datasets": [], + "members": [], + "parameters": [], }, id="Basic /documents/{pid} request", ), @@ -58,21 +133,10 @@ class TestSearchAPIGetByPIDEndpoint: "2", "{}", { - "description": "Former outside source play nearly Congress before" - " necessary. Allow want audience test laugh. Economic body person" - " general attorney. Effort weight prevent possible.", - "modId": "user", - "createTime": "2019-02-19 05:57:03+00:00", - "pid": None, - "createId": "user", - "type": "2", + "pid": "2", "name": "INSTRUMENT 2", - "modTime": "2019-01-29 23:33:20+00:00", - "id": 2, - "fullName": "With piece reason late model. House office fly." - " International scene call deep answer audience baby true.\n" - "Indicate education across these. Opportunity design too.", - "url": "https://moore.org/", + "facility": "LILS", + "datasets": [], }, id="Basic /instruments/{pid} request", ), @@ -80,48 +144,9 @@ class TestSearchAPIGetByPIDEndpoint: "datasets", "0-8401-1070-7", '{"include": [{"relation": "documents"}]}', - { - "createId": "user", - "startDate": "2000-10-13 00:00:00+00:00", - "doi": "0-8401-1070-7", - "modTime": "2006-08-24 01:28:06+00:00", - "createTime": "2013-04-01 10:56:52+00:00", - "location": "/subject/break.jpeg", - "endDate": "2000-02-10 00:00:00+00:00", - "complete": True, - "modId": "user", - "documents": [ - { - "createId": "user", - "doi": "0-9729806-3-6", - "startDate": "2000-06-04 00:00:00+00:00", - "modTime": "2016-11-16 19:42:34+00:00", - "createTime": "2004-08-23 02:41:19+00:00", - "endDate": "2000-09-14 00:00:00+00:00", - "modId": "user", - "title": "Show fly image herself yard challenge by. Past" - " site her number. Not weight half far move. Leader" - " everyone skin still.\nProve begin boy those always" - " dream write inside.", - "summary": "Day purpose item create. Visit hope mean admit." - " The tonight adult cut foreign would situation fund.\n" - "Purpose study usually gas think. Machine world doctor" - " rise be college treat.", - "visitId": "4", - "name": "INVESTIGATION 2", - "releaseDate": "2000-02-10 00:00:00+00:00", - "id": 2, - }, - ], - "description": "Beat professional blue clear style have. Light" - " final summer. Or hour color maybe word side much team." - "\nMessage weight official learn especially nature. Himself" - " tax west.", - "name": "DATASET 2", - "id": 2, - }, + {}, id="Get dataset by pid with include filter", - # Skipped because of incorrect document JSON format + # TODO - issue with Document.type marks=pytest.mark.skip, ), pytest.param( @@ -129,56 +154,127 @@ class TestSearchAPIGetByPIDEndpoint: "0-449-78690-0", '{"include": [{"relation": "datasets"}]}', { + "pid": "0-449-78690-0", + "isPublic": True, + "type": "INVESTIGATIONTYPE 2", + "title": "INVESTIGATION 1", + "summary": "Season identify professor happen third. Beat" + " professional blue clear style have. Light final summer.", + "doi": "0-449-78690-0", + "startDate": "2000-04-03T00:00:00+00:00", + "endDate": "2000-07-09T00:00:00+00:00", + "releaseDate": "2000-07-05T00:00:00+00:00", + "license": None, + "keywords": [ + "read123", + "boy129", + "out253", + "hour326", + "possible449", + "west566", + "scene948", + "who1253", + "capital1526", + "dream1989", + "front2347", + "inside2465", + "surface2851", + "learn2953", + "hot3053", + "just3159", + "population3261", + "cup3366", + "another3451", + "environmental3632", + "require3858", + "rock3952", + "determine4048", + "space4061", + "big4229", + "why4243", + "public4362", + "election4641", + "measure4996", + "often5014", + "develop5135", + "than5310", + "floor5312", + "check5327", + "cost5487", + "information6130", + "guy6180", + "admit6235", + "market6645", + "law6777", + "close7336", + "billion7597", + "product7964", + "American8041", + "language8246", + "school8277", + "specific8539", + "position8670", + "grow8702", + "time8899", + "weight9086", + "catch9129", + "speak9559", + "strong9621", + "development9757", + "best9786", + "identify10039", + "give10497", + "life10854", + "century11040", + "fire11580", + "leg11744", + "past11935", + "bar12034", + "do12108", + "prove12224", + "body12251", + "data12288", + "at12640", + "star12706", + "customer12795", + "small13058", + "event13141", + "now13193", + "magazine13415", + "policy13601", + "black13996", + "American14654", + ], "datasets": [ { - "createId": "user", - "startDate": "2000-05-07 00:00:00+00:00", - "doi": "0-449-78690-0", - "modTime": "2005-04-30 19:41:49+00:00", - "createTime": "2002-11-27 06:20:36+00:00", - "location": "/international/subject.tiff", - "endDate": "2000-07-05 00:00:00+00:00", - "complete": True, - "modId": "user", - "description": "Many last prepare small. Maintain throw" - " hope parent.\nEntire soon option bill fish against power." - "\nRather why rise month shake voice.", - "name": "DATASET 1", - "id": 1, + "pid": "0-449-78690-0", + "title": "DATASET 1", + "isPublic": True, + "creationDate": "2002-11-27T06:20:36+00:00", + "size": None, + "documents": [], + "techniques": [], + "instrument": None, + "files": [], + "parameters": [], + "samples": [], }, { - "createId": "user", - "startDate": "2060-01-07 00:00:00+00:00", - "doi": "0-353-84629-5", - "modTime": "2002-09-30 13:03:32+00:00", - "createTime": "2006-11-21 17:10:42+00:00", - "location": "/gun/special.jpeg", - "endDate": "2060-01-17 00:00:00+00:00", - "complete": True, - "modId": "user", - "description": "Single many hope organization reach process" - " I. Health hit total federal describe. Bill firm rate" - " democratic outside.\nLate while our either worry.", - "name": "DATASET 241", - "id": 241, + "pid": "0-353-84629-5", + "title": "DATASET 241", + "isPublic": True, + "creationDate": "2006-11-21T17:10:42+00:00", + "size": None, + "documents": [], + "techniques": [], + "instrument": None, + "files": [], + "parameters": [], + "samples": [], }, ], - "visitId": "42", - "modId": "user", - "name": "INVESTIGATION 1", - "createId": "user", - "createTime": "2002-11-27 06:20:36+00:00", - "doi": "0-449-78690-0", - "id": 1, - "summary": "Season identify professor happen third. Beat" - " professional blue clear style have. Light final summer.", - "endDate": "2000-07-09 00:00:00+00:00", - "modTime": "2005-04-30 19:41:49+00:00", - "releaseDate": "2000-07-05 00:00:00+00:00", - "startDate": "2000-04-03 00:00:00+00:00", - "title": "Including spend increase ability music skill former." - " Agreement director concern once technology sometimes someone" - " staff.\nSuccess pull bar. Laugh senior example.", + "members": [], + "parameters": [], }, id="Get document by pid with include filter", ), @@ -207,55 +303,26 @@ class TestSearchAPIGetByPIDEndpoint: # Skipped due to ICAT 5 mapping marks=pytest.mark.skip, ), + pytest.param( + "datasets", + "0-8401-1070-7", + '{"include": [{"relation": "documents"}, {"relation": "instrument"},' + ' {"relation": "files"}, {"relation": "parameters"},' + ' {"relation": "samples"}]}', + {}, + id="Get dataset by pid including all ICAT 4 related entities", + # TODO - issue with parameters include + marks=pytest.mark.skip, + ), pytest.param( "datasets", "0-8401-1070-7", '{"include": [{"relation": "documents"}, {"relation": "techniques"},' ' {"relation": "instrument"}, {"relation": "files"},' ' {"relation": "parameters"}, {"relation": "samples"}]}', - { - "createId": "user", - "startDate": "2000-10-13 00:00:00+00:00", - "doi": "0-8401-1070-7", - "modTime": "2006-08-24 01:28:06+00:00", - "createTime": "2013-04-01 10:56:52+00:00", - "location": "/subject/break.jpeg", - "endDate": "2000-02-10 00:00:00+00:00", - "complete": True, - "modId": "user", - "documents": [ - { - "createId": "user", - "doi": "0-9729806-3-6", - "startDate": "2000-06-04 00:00:00+00:00", - "modTime": "2016-11-16 19:42:34+00:00", - "createTime": "2004-08-23 02:41:19+00:00", - "endDate": "2000-09-14 00:00:00+00:00", - "modId": "user", - "title": "Show fly image herself yard challenge by. Past" - " site her number. Not weight half far move. Leader" - " everyone skin still.\nProve begin boy those always" - " dream write inside.", - "summary": "Day purpose item create. Visit hope mean admit." - " The tonight adult cut foreign would situation fund.\n" - "Purpose study usually gas think. Machine world doctor" - " rise be college treat.", - "visitId": "4", - "name": "INVESTIGATION 2", - "releaseDate": "2000-02-10 00:00:00+00:00", - "id": 2, - }, - ], - "description": "Beat professional blue clear style have. Light" - " final summer. Or hour color maybe word side much team." - "\nMessage weight official learn especially nature. Himself" - " tax west.", - "name": "DATASET 2", - "id": 2, - }, + {}, id="Get dataset by pid including all possible related entities", - # Skipped because of incorrect document JSON format and ICAT 5 mapping - # on techniques and instrument + # Skipped ICAT 5 mapping on techniques and instrument marks=pytest.mark.skip, ), pytest.param( @@ -263,89 +330,9 @@ class TestSearchAPIGetByPIDEndpoint: "0-449-78690-0", '{"include": [{"relation": "datasets"}, {"relation": "members"},' ' {"relation": "parameters"}]}', - { - "datasets": [ - { - "createId": "user", - "startDate": "2000-05-07 00:00:00+00:00", - "doi": "0-449-78690-0", - "modTime": "2005-04-30 19:41:49+00:00", - "createTime": "2002-11-27 06:20:36+00:00", - "location": "/international/subject.tiff", - "endDate": "2000-07-05 00:00:00+00:00", - "complete": True, - "modId": "user", - "description": "Many last prepare small. Maintain throw" - " hope parent.\nEntire soon option bill fish against power." - "\nRather why rise month shake voice.", - "parameters": [], - "name": "DATASET 1", - "id": 1, - }, - { - "createId": "user", - "startDate": "2060-01-07 00:00:00+00:00", - "doi": "0-353-84629-5", - "modTime": "2002-09-30 13:03:32+00:00", - "createTime": "2006-11-21 17:10:42+00:00", - "location": "/gun/special.jpeg", - "endDate": "2060-01-17 00:00:00+00:00", - "complete": True, - "modId": "user", - "description": "Single many hope organization reach process" - " I. Health hit total federal describe. Bill firm rate" - " democratic outside.\nLate while our either worry.", - "parameters": [], - "name": "DATASET 241", - "id": 241, - }, - ], - "createId": "user", - "doi": "0-449-78690-0", - "startDate": "2000-04-03 00:00:00+00:00", - "modTime": "2005-04-30 19:41:49+00:00", - "createTime": "2002-11-27 06:20:36+00:00", - "members": [ - { - "createId": "user", - "modId": "user", - "modTime": "2005-04-30 19:41:49+00:00", - "role": "CI", - "createTime": "2002-11-27 06:20:36+00:00", - "id": 1, - }, - ], - "endDate": "2000-07-09 00:00:00+00:00", - "modId": "user", - "title": "Including spend increase ability music skill former." - " Agreement director concern once technology sometimes someone" - " staff.\nSuccess pull bar. Laugh senior example.", - "summary": "Season identify professor happen third. Beat" - " professional blue clear style have. Light final summer.", - "visitId": "42", - "parameters": [ - { - "dateTimeValue": "2000-05-07 00:00:00+00:00", - "rangeBottom": 48.0, - "createId": "user", - "numericValue": 127265.0, - "modTime": "2005-04-30 19:41:49+00:00", - "createTime": "2002-11-27 06:20:36+00:00", - "id": 1, - "stringValue": "international1", - "modId": "user", - "rangeTop": 101.0, - "error": 31472.0, - }, - ], - "name": "INVESTIGATION 1", - "releaseDate": "2000-07-05 00:00:00+00:00", - "id": 1, - }, + {}, id="Get document by pid including all possible related entities", - # Skipped because of incorrect members JSON naming - # (investigationUsers key used instead). It's in ICAT fields too, - # not converted into PaNOSC format + # TODO - issue with parameters include marks=pytest.mark.skip, ), ], diff --git a/test/search_api/endpoints/test_search_endpoint.py b/test/search_api/endpoints/test_search_endpoint.py index 024bd6e1..aa7b606c 100644 --- a/test/search_api/endpoints/test_search_endpoint.py +++ b/test/search_api/endpoints/test_search_endpoint.py @@ -221,122 +221,18 @@ class TestSearchAPISearchEndpoint: '{"include": [{"relation": "documents"}, {"relation": "techniques"},' ' {"relation": "instrument"}, {"relation": "files"},' ' {"relation": "parameters"}, {"relation": "samples"}], "limit": 1}', - [ - { - "createId": "user", - "startDate": "2000-10-13 00:00:00+00:00", - "doi": "0-8401-1070-7", - "modTime": "2006-08-24 01:28:06+00:00", - "createTime": "2013-04-01 10:56:52+00:00", - "location": "/subject/break.jpeg", - "endDate": "2000-02-10 00:00:00+00:00", - "complete": True, - "modId": "user", - "documents": [{}], - "description": "Beat professional blue clear style have. Light" - " final summer. Or hour color maybe word side much team." - "\nMessage weight official learn especially nature. Himself" - " tax west.", - "name": "DATASET 2", - "id": 2, - }, - ], + [{}], id="Search datasets including all possible related entities", - # Skipped because of incorrect document JSON format and ICAT 5 mapping - # on techniques and instrument + # Skipped because ICAT 5 mapping on techniques and instrument marks=pytest.mark.skip, ), pytest.param( "documents", '{"include": [{"relation": "datasets"}, {"relation": "members"},' ' {"relation": "parameters"}], "limit": 1}', - [ - { - "datasets": [ - { - "createId": "user", - "startDate": "2000-05-07 00:00:00+00:00", - "doi": "0-449-78690-0", - "modTime": "2005-04-30 19:41:49+00:00", - "createTime": "2002-11-27 06:20:36+00:00", - "location": "/international/subject.tiff", - "endDate": "2000-07-05 00:00:00+00:00", - "complete": True, - "modId": "user", - "description": "Many last prepare small. Maintain throw" - " hope parent.\nEntire soon option bill fish against" - " power." - "\nRather why rise month shake voice.", - "parameters": [], - "name": "DATASET 1", - "id": 1, - }, - { - "createId": "user", - "startDate": "2060-01-07 00:00:00+00:00", - "doi": "0-353-84629-5", - "modTime": "2002-09-30 13:03:32+00:00", - "createTime": "2006-11-21 17:10:42+00:00", - "location": "/gun/special.jpeg", - "endDate": "2060-01-17 00:00:00+00:00", - "complete": True, - "modId": "user", - "description": "Single many hope organization reach" - " process I. Health hit total federal describe. Bill" - " firm rate democratic outside.\nLate while our either" - " worry.", - "parameters": [], - "name": "DATASET 241", - "id": 241, - }, - ], - "createId": "user", - "doi": "0-449-78690-0", - "startDate": "2000-04-03 00:00:00+00:00", - "modTime": "2005-04-30 19:41:49+00:00", - "createTime": "2002-11-27 06:20:36+00:00", - "members": [ - { - "createId": "user", - "modId": "user", - "modTime": "2005-04-30 19:41:49+00:00", - "role": "CI", - "createTime": "2002-11-27 06:20:36+00:00", - "id": 1, - }, - ], - "endDate": "2000-07-09 00:00:00+00:00", - "modId": "user", - "title": "Including spend increase ability music skill former." - " Agreement director concern once technology sometimes someone" - " staff.\nSuccess pull bar. Laugh senior example.", - "summary": "Season identify professor happen third. Beat" - " professional blue clear style have. Light final summer.", - "visitId": "42", - "parameters": [ - { - "dateTimeValue": "2000-05-07 00:00:00+00:00", - "rangeBottom": 48.0, - "createId": "user", - "numericValue": 127265.0, - "modTime": "2005-04-30 19:41:49+00:00", - "createTime": "2002-11-27 06:20:36+00:00", - "id": 1, - "stringValue": "international1", - "modId": "user", - "rangeTop": 101.0, - "error": 31472.0, - }, - ], - "name": "INVESTIGATION 1", - "releaseDate": "2000-07-05 00:00:00+00:00", - "id": 1, - }, - ], + [{}], id="Search documents including all possible related entities", - # Skipped because of incorrect members JSON naming - # (investigationUsers key used instead). It's in ICAT fields too, - # not converted into PaNOSC format + # TODO - issue with parameters include marks=pytest.mark.skip, ), pytest.param(