From f20ad24886f85bb3ba70abfd29352b1a7e5c58ff Mon Sep 17 00:00:00 2001 From: Matthew Richards Date: Tue, 22 Feb 2022 15:25:31 +0000 Subject: [PATCH 01/10] feat: allow multiple datetime formats to be used when filtering in search API #338 --- datagateway_api/src/search_api/filters.py | 14 ++++++++++++++ .../filters/test_search_api_where_filter.py | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/datagateway_api/src/search_api/filters.py b/datagateway_api/src/search_api/filters.py index 2786d0c2..b3879e8c 100644 --- a/datagateway_api/src/search_api/filters.py +++ b/datagateway_api/src/search_api/filters.py @@ -9,6 +9,7 @@ PythonICATSkipFilter, PythonICATWhereFilter, ) +from datagateway_api.src.search_api.models import PaNOSCAttribute from datagateway_api.src.search_api.panosc_mappings import mappings from datagateway_api.src.search_api.query import SearchAPIQuery @@ -19,6 +20,19 @@ class SearchAPIWhereFilter(PythonICATWhereFilter): def __init__(self, field, value, operation, search_api_query=None): self.search_api_query = search_api_query super().__init__(field, value, operation) + + # Detect various datetime formats and convert them into a format that ICAT can + # understand + if ( + self.field in PaNOSCAttribute._datetime_field_names + and isinstance(self.value, str) + and DateHandler.is_str_a_date(self.value) + ): + value_datetime = DateHandler.str_to_datetime_object(value) + str_datetime = DateHandler.datetime_object_to_str(value_datetime) + # +/- need to be removed so the format works when querying ICAT + self.value = str_datetime.replace("+", " ").replace("-", " ") + log.info("SearchAPIWhereFilter created: %s", repr(self)) def apply_filter(self, query): diff --git a/test/search_api/filters/test_search_api_where_filter.py b/test/search_api/filters/test_search_api_where_filter.py index f212b20c..99142015 100644 --- a/test/search_api/filters/test_search_api_where_filter.py +++ b/test/search_api/filters/test_search_api_where_filter.py @@ -52,7 +52,7 @@ class TestSearchAPIWhereFilter: SearchAPIWhereFilter("startDate", "2018-05-05T15:00:00.000Z", "gt"), "Document", "SELECT o FROM Investigation o WHERE o.startDate >" - " '2018-05-05T15:00:00.000Z'", + " '2018 05 05 15:00:00 00:00'", id="WHERE filter with date value", ), pytest.param( From 4596db98808f35488aca86667aa26811d777b58e Mon Sep 17 00:00:00 2001 From: Matthew Richards Date: Tue, 22 Feb 2022 15:26:05 +0000 Subject: [PATCH 02/10] fix: output datetime data in the same format as SciCat #338 --- datagateway_api/src/search_api/models.py | 28 ++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/datagateway_api/src/search_api/models.py b/datagateway_api/src/search_api/models.py index 65d7352f..2fc1e3ad 100644 --- a/datagateway_api/src/search_api/models.py +++ b/datagateway_api/src/search_api/models.py @@ -4,6 +4,7 @@ from typing import ClassVar, List, Optional, Union from pydantic import BaseModel, Field, root_validator, ValidationError, validator +from pydantic.datetime_parse import parse_datetime from pydantic.error_wrappers import ErrorWrapper from datagateway_api.src.search_api.panosc_mappings import mappings @@ -44,7 +45,26 @@ def _get_icat_field_value(icat_field_name, icat_data): return icat_data +class SearchAPIDatetime(datetime): + """ + An alternative datetime class so datetimes can be outputted in a different format to + DataGateway API + """ + + @classmethod + def __get_validators__(cls): + # Use default pydantic behaviour as well as behaviour defined in this class + yield parse_datetime + yield cls.use_search_api_format + + @classmethod + def use_search_api_format(cls, v): + return v.strftime("%Y-%m-%dT%H:%M:%S.%f")[:-3] + "Z" + + class PaNOSCAttribute(ABC, BaseModel): + _datetime_field_names = ["creationDate", "startDate", "endDate", "releaseDate"] + @classmethod @abstractmethod def from_icat(cls, icat_data, required_related_fields): # noqa: B902, N805 @@ -178,7 +198,7 @@ class Dataset(PaNOSCAttribute): pid: str title: str is_public: bool = Field(alias="isPublic") - creation_date: datetime = Field(alias="creationDate") + creation_date: SearchAPIDatetime = Field(alias="creationDate") size: Optional[int] = None documents: List["Document"] = [] @@ -218,9 +238,9 @@ class Document(PaNOSCAttribute): title: str summary: Optional[str] = None doi: Optional[str] = None - start_date: Optional[datetime] = Field(None, alias="startDate") - end_date: Optional[datetime] = Field(None, alias="endDate") - release_date: Optional[datetime] = Field(None, alias="releaseDate") + start_date: Optional[SearchAPIDatetime] = Field(None, alias="startDate") + end_date: Optional[SearchAPIDatetime] = Field(None, alias="endDate") + release_date: Optional[SearchAPIDatetime] = Field(None, alias="releaseDate") license_: Optional[str] = Field(None, alias="license") keywords: Optional[List[str]] = [] From 32554f6c8d00babd2397a2f5e11bf46f46862b2e Mon Sep 17 00:00:00 2001 From: Matthew Richards Date: Fri, 11 Mar 2022 17:07:30 +0000 Subject: [PATCH 03/10] ci: change ICAT Ansible branch --- .github/workflows/ci-build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index ddcff9d1..3defc235 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -34,7 +34,7 @@ jobs: uses: actions/checkout@v2 with: repository: icatproject-contrib/icat-ansible - ref: master + ref: fix_warnings_#23 path: icat-ansible - name: Install Ansible run: pip install -r icat-ansible/requirements.txt @@ -195,7 +195,7 @@ jobs: uses: actions/checkout@v2 with: repository: icatproject-contrib/icat-ansible - ref: master + ref: fix_warnings_#23 path: icat-ansible - name: Install Ansible run: pip install -r icat-ansible/requirements.txt From a24e03227a410e32bb11fecf8eba8e81fd85ea1c Mon Sep 17 00:00:00 2001 From: Matthew Richards Date: Fri, 11 Mar 2022 17:08:00 +0000 Subject: [PATCH 04/10] ci: change ICAT Ansible host references to use underscores - This relates to the changes made in https://github.com/icatproject-contrib/icat-ansible/issues/23 --- .github/workflows/ci-build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 3defc235..1e5ede6c 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -41,7 +41,7 @@ jobs: # Prep for running the playbook - name: Create hosts file - run: echo -e "[icatdb-minimal-hosts]\nlocalhost ansible_connection=local" > icat-ansible/hosts + run: echo -e "[icatdb_minimal_hosts]\nlocalhost ansible_connection=local" > icat-ansible/hosts - name: Prepare vault pass run: echo -e "icattravispw" > icat-ansible/vault_pass.txt - name: Move vault to directory it'll get detected by Ansible @@ -57,7 +57,7 @@ jobs: # Create local instance of ICAT - name: Run ICAT Ansible Playbook run: | - ansible-playbook icat-ansible/icatdb-minimal-hosts.yml -i icat-ansible/hosts --vault-password-file icat-ansible/vault_pass.txt -vv + ansible-playbook icat-ansible/icatdb_minimal_hosts.yml -i icat-ansible/hosts --vault-password-file icat-ansible/vault_pass.txt -vv # rootUserNames needs editing as anon/anon is used in search API and required to pass endpoint tests - name: Add anon user to rootUserNames @@ -202,7 +202,7 @@ jobs: # Prep for running the playbook - name: Create hosts file - run: echo -e "[icatdb-minimal-hosts]\nlocalhost ansible_connection=local" > icat-ansible/hosts + run: echo -e "[icatdb_minimal_hosts]\nlocalhost ansible_connection=local" > icat-ansible/hosts - name: Prepare vault pass run: echo -e "icattravispw" > icat-ansible/vault_pass.txt - name: Move vault to directory it'll get detected by Ansible @@ -218,7 +218,7 @@ jobs: # Create local instance of ICAT - name: Run ICAT Ansible Playbook run: | - ansible-playbook icat-ansible/icatdb-minimal-hosts.yml -i icat-ansible/hosts --vault-password-file icat-ansible/vault_pass.txt -vv + ansible-playbook icat-ansible/icatdb_minimal_hosts.yml -i icat-ansible/hosts --vault-password-file icat-ansible/vault_pass.txt -vv - name: Checkout DataGateway API uses: actions/checkout@v2 From 3c622d5c2753ad4e8e2d729e11f95441206e0870 Mon Sep 17 00:00:00 2001 From: Matthew Richards Date: Tue, 15 Mar 2022 12:42:20 +0000 Subject: [PATCH 05/10] Change ICAT Ansible branch --- .github/workflows/ci-build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 1e5ede6c..e485a0fb 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -34,7 +34,7 @@ jobs: uses: actions/checkout@v2 with: repository: icatproject-contrib/icat-ansible - ref: fix_warnings_#23 + ref: underscore_changes path: icat-ansible - name: Install Ansible run: pip install -r icat-ansible/requirements.txt @@ -195,7 +195,7 @@ jobs: uses: actions/checkout@v2 with: repository: icatproject-contrib/icat-ansible - ref: fix_warnings_#23 + ref: underscore_changes path: icat-ansible - name: Install Ansible run: pip install -r icat-ansible/requirements.txt From b1f46cf66d1113636667725cb2631c2de2a580ac Mon Sep 17 00:00:00 2001 From: Matthew Richards Date: Wed, 16 Mar 2022 13:41:16 +0000 Subject: [PATCH 06/10] ci: move back to ICAT Ansible master branch --- .github/workflows/ci-build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index e485a0fb..3a87bf1b 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -34,7 +34,7 @@ jobs: uses: actions/checkout@v2 with: repository: icatproject-contrib/icat-ansible - ref: underscore_changes + ref: master path: icat-ansible - name: Install Ansible run: pip install -r icat-ansible/requirements.txt @@ -195,7 +195,7 @@ jobs: uses: actions/checkout@v2 with: repository: icatproject-contrib/icat-ansible - ref: underscore_changes + ref: master path: icat-ansible - name: Install Ansible run: pip install -r icat-ansible/requirements.txt From 01968c0a19ba38b75dc577a82046bc43cdd2edab Mon Sep 17 00:00:00 2001 From: Matthew Richards Date: Thu, 17 Mar 2022 14:41:43 +0000 Subject: [PATCH 07/10] test: fix datetime formatting on search API tests #338 --- .../endpoints/test_get_dataset_files.py | 2 +- .../endpoints/test_get_entity_by_pid.py | 44 +++++++++---------- .../endpoints/test_search_endpoint.py | 28 ++++++------ test/search_api/test_models.py | 17 ++++--- 4 files changed, 47 insertions(+), 44 deletions(-) diff --git a/test/search_api/endpoints/test_get_dataset_files.py b/test/search_api/endpoints/test_get_dataset_files.py index e0d47f6a..91f2b784 100644 --- a/test/search_api/endpoints/test_get_dataset_files.py +++ b/test/search_api/endpoints/test_get_dataset_files.py @@ -103,7 +103,7 @@ class TestSearchAPIGetDatasetFilesEndpoint: "pid": "0-8401-1070-7", "title": "DATASET 2", "isPublic": True, - "creationDate": "2013-04-01T10:56:52+00:00", + "creationDate": "2013-04-01T10:56:52.000Z", "size": None, "documents": [], "techniques": [], 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 f85ffbb6..cfe6264d 100644 --- a/test/search_api/endpoints/test_get_entity_by_pid.py +++ b/test/search_api/endpoints/test_get_entity_by_pid.py @@ -15,7 +15,7 @@ class TestSearchAPIGetByPIDEndpoint: "pid": "0-8401-1070-7", "title": "DATASET 2", "isPublic": True, - "creationDate": "2013-04-01T10:56:52+00:00", + "creationDate": "2013-04-01T10:56:52.000Z", "size": None, "documents": [], "techniques": [], @@ -38,9 +38,9 @@ class TestSearchAPIGetByPIDEndpoint: "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", + "startDate": "2000-04-03T00:00:00.000Z", + "endDate": "2000-07-09T00:00:00.000Z", + "releaseDate": "2000-07-05T00:00:00.000Z", "license": None, "keywords": [ "read123", @@ -148,7 +148,7 @@ class TestSearchAPIGetByPIDEndpoint: "pid": "0-8401-1070-7", "title": "DATASET 2", "isPublic": True, - "creationDate": "2013-04-01T10:56:52+00:00", + "creationDate": "2013-04-01T10:56:52.000Z", "size": None, "documents": [ { @@ -161,9 +161,9 @@ class TestSearchAPIGetByPIDEndpoint: "\nPurpose study usually gas think. Machine world doctor" " rise be college treat.", "doi": "0-9729806-3-6", - "startDate": "2000-06-04T00:00:00+00:00", - "endDate": "2000-09-14T00:00:00+00:00", - "releaseDate": "2000-02-10T00:00:00+00:00", + "startDate": "2000-06-04T00:00:00.000Z", + "endDate": "2000-09-14T00:00:00.000Z", + "releaseDate": "2000-02-10T00:00:00.000Z", "license": None, "keywords": [ "later868", @@ -262,9 +262,9 @@ class TestSearchAPIGetByPIDEndpoint: "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", + "startDate": "2000-04-03T00:00:00.000Z", + "endDate": "2000-07-09T00:00:00.000Z", + "releaseDate": "2000-07-05T00:00:00.000Z", "license": None, "keywords": [ "read123", @@ -351,7 +351,7 @@ class TestSearchAPIGetByPIDEndpoint: "pid": "0-449-78690-0", "title": "DATASET 1", "isPublic": True, - "creationDate": "2002-11-27T06:20:36+00:00", + "creationDate": "2002-11-27T06:20:36.000Z", "size": None, "documents": [], "techniques": [], @@ -364,7 +364,7 @@ class TestSearchAPIGetByPIDEndpoint: "pid": "0-353-84629-5", "title": "DATASET 241", "isPublic": True, - "creationDate": "2006-11-21T17:10:42+00:00", + "creationDate": "2006-11-21T17:10:42.000Z", "size": None, "documents": [], "techniques": [], @@ -414,7 +414,7 @@ class TestSearchAPIGetByPIDEndpoint: "pid": "0-8401-1070-7", "title": "DATASET 2", "isPublic": True, - "creationDate": "2013-04-01T10:56:52+00:00", + "creationDate": "2013-04-01T10:56:52.000Z", "size": None, "documents": [ { @@ -427,9 +427,9 @@ class TestSearchAPIGetByPIDEndpoint: "\nPurpose study usually gas think. Machine world doctor " "rise be college treat.", "doi": "0-9729806-3-6", - "startDate": "2000-06-04T00:00:00+00:00", - "endDate": "2000-09-14T00:00:00+00:00", - "releaseDate": "2000-02-10T00:00:00+00:00", + "startDate": "2000-06-04T00:00:00.000Z", + "endDate": "2000-09-14T00:00:00.000Z", + "releaseDate": "2000-02-10T00:00:00.000Z", "license": None, "keywords": [ "later868", @@ -943,9 +943,9 @@ class TestSearchAPIGetByPIDEndpoint: "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", + "startDate": "2000-04-03T00:00:00.000Z", + "endDate": "2000-07-09T00:00:00.000Z", + "releaseDate": "2000-07-05T00:00:00.000Z", "license": None, "keywords": [ "read123", @@ -1032,7 +1032,7 @@ class TestSearchAPIGetByPIDEndpoint: "pid": "0-449-78690-0", "title": "DATASET 1", "isPublic": True, - "creationDate": "2002-11-27T06:20:36+00:00", + "creationDate": "2002-11-27T06:20:36.000Z", "size": None, "documents": [], "techniques": [], @@ -1045,7 +1045,7 @@ class TestSearchAPIGetByPIDEndpoint: "pid": "0-353-84629-5", "title": "DATASET 241", "isPublic": True, - "creationDate": "2006-11-21T17:10:42+00:00", + "creationDate": "2006-11-21T17:10:42.000Z", "size": None, "documents": [], "techniques": [], diff --git a/test/search_api/endpoints/test_search_endpoint.py b/test/search_api/endpoints/test_search_endpoint.py index d75fb813..17398f5d 100644 --- a/test/search_api/endpoints/test_search_endpoint.py +++ b/test/search_api/endpoints/test_search_endpoint.py @@ -14,7 +14,7 @@ class TestSearchAPISearchEndpoint: { "pid": "0-449-78690-0", "title": "DATASET 1", - "creationDate": "2002-11-27T06:20:36+00:00", + "creationDate": "2002-11-27T06:20:36.000Z", "isPublic": True, "size": None, "documents": [], @@ -27,7 +27,7 @@ class TestSearchAPISearchEndpoint: { "pid": "0-8401-1070-7", "title": "DATASET 2", - "creationDate": "2013-04-01T10:56:52+00:00", + "creationDate": "2013-04-01T10:56:52.000Z", "isPublic": True, "size": None, "documents": [], @@ -52,9 +52,9 @@ class TestSearchAPISearchEndpoint: "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", + "startDate": "2000-04-03T00:00:00.000Z", + "endDate": "2000-07-09T00:00:00.000Z", + "releaseDate": "2000-07-05T00:00:00.000Z", "license": None, "keywords": [ "read123", @@ -170,7 +170,7 @@ class TestSearchAPISearchEndpoint: "pid": "0-468-20341-9", "title": "DATASET 6", "isPublic": True, - "creationDate": "2008-06-30T08:30:58+00:00", + "creationDate": "2008-06-30T08:30:58.000Z", "size": None, "documents": [], "techniques": [], @@ -198,13 +198,13 @@ class TestSearchAPISearchEndpoint: pytest.param( "datasets", '{"limit": 1, "where": {"creationDate": {"gt":' - ' "2007-06-30 08:30:58+00:00"}}}', + ' "2007-06-30T08:30:58.000Z"}}}', [ { "pid": "0-8401-1070-7", "title": "DATASET 2", "isPublic": True, - "creationDate": "2013-04-01T10:56:52+00:00", + "creationDate": "2013-04-01T10:56:52.000Z", "size": None, "documents": [], "techniques": [], @@ -239,9 +239,9 @@ class TestSearchAPISearchEndpoint: "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", + "startDate": "2000-04-03T00:00:00.000Z", + "endDate": "2000-07-09T00:00:00.000Z", + "releaseDate": "2000-07-05T00:00:00.000Z", "license": None, "keywords": [ "read123", @@ -328,7 +328,7 @@ class TestSearchAPISearchEndpoint: "pid": "0-449-78690-0", "title": "DATASET 1", "isPublic": True, - "creationDate": "2002-11-27T06:20:36+00:00", + "creationDate": "2002-11-27T06:20:36.000Z", "size": None, "documents": [], "techniques": [], @@ -341,7 +341,7 @@ class TestSearchAPISearchEndpoint: "pid": "0-353-84629-5", "title": "DATASET 241", "isPublic": True, - "creationDate": "2006-11-21T17:10:42+00:00", + "creationDate": "2006-11-21T17:10:42.000Z", "size": None, "documents": [], "techniques": [], @@ -405,7 +405,7 @@ class TestSearchAPISearchEndpoint: { "pid": "0-449-78690-0", "title": "DATASET 1", - "creationDate": "2002-11-27T06:20:36+00:00", + "creationDate": "2002-11-27T06:20:36.000Z", "isPublic": True, "size": None, "documents": [], diff --git a/test/search_api/test_models.py b/test/search_api/test_models.py index 7cd0e10b..f88d0ec1 100644 --- a/test/search_api/test_models.py +++ b/test/search_api/test_models.py @@ -3,6 +3,7 @@ from datagateway_api.src.common.date_handler import DateHandler import datagateway_api.src.search_api.models as models +from datagateway_api.src.search_api.models import SearchAPIDatetime AFFILIATION_ICAT_DATA = { @@ -199,8 +200,8 @@ DATASET_PANOSC_DATA = { "pid": DATASET_ICAT_DATA["doi"], "title": DATASET_ICAT_DATA["name"], - "creationDate": DateHandler.str_to_datetime_object( - DATASET_ICAT_DATA["createTime"], + "creationDate": SearchAPIDatetime.use_search_api_format( + DateHandler.str_to_datetime_object(DATASET_ICAT_DATA["createTime"]), ), "isPublic": True, "size": None, @@ -219,12 +220,14 @@ "title": INVESTIGATION_ICAT_DATA["name"], "summary": INVESTIGATION_ICAT_DATA["summary"], "doi": INVESTIGATION_ICAT_DATA["doi"], - "startDate": DateHandler.str_to_datetime_object( - INVESTIGATION_ICAT_DATA["startDate"], + "startDate": SearchAPIDatetime.use_search_api_format( + DateHandler.str_to_datetime_object(INVESTIGATION_ICAT_DATA["startDate"]), ), - "endDate": DateHandler.str_to_datetime_object(INVESTIGATION_ICAT_DATA["endDate"]), - "releaseDate": DateHandler.str_to_datetime_object( - INVESTIGATION_ICAT_DATA["releaseDate"], + "endDate": SearchAPIDatetime.use_search_api_format( + DateHandler.str_to_datetime_object(INVESTIGATION_ICAT_DATA["endDate"]), + ), + "releaseDate": SearchAPIDatetime.use_search_api_format( + DateHandler.str_to_datetime_object(INVESTIGATION_ICAT_DATA["releaseDate"]), ), "license": None, "keywords": [KEYWORD_ICAT_DATA["name"]], From 939fc77287f4c6bcbcae8c16a9a5e5a0627fe71d Mon Sep 17 00:00:00 2001 From: Matthew Richards Date: Thu, 17 Mar 2022 16:40:13 +0000 Subject: [PATCH 08/10] test: convert datetime formats on search endpoint tests #338 --- .../endpoints/test_search_endpoint.py | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/test/search_api/endpoints/test_search_endpoint.py b/test/search_api/endpoints/test_search_endpoint.py index 46150bc5..c5d1209a 100644 --- a/test/search_api/endpoints/test_search_endpoint.py +++ b/test/search_api/endpoints/test_search_endpoint.py @@ -382,12 +382,12 @@ class TestSearchAPISearchEndpoint: " 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", + "createTime": "2019-02-19 05:57:03.000Z", "pid": None, "createId": "user", "type": "2", "name": "INSTRUMENT 2", - "modTime": "2019-01-29 23:33:20+00:00", + "modTime": "2019-01-29 23:33:20.000Z", "id": 2, "fullName": "With piece reason late model. House office fly." " International scene call deep answer audience baby true.\n" @@ -444,7 +444,7 @@ class TestSearchAPISearchEndpoint: "pid": "1-71624-154-5", "title": "DATASET 50", "isPublic": True, - "creationDate": "2008-05-29T03:28:31+00:00", + "creationDate": "2008-05-29T03:28:31.000Z", "size": None, "documents": [], "techniques": [], @@ -476,7 +476,7 @@ class TestSearchAPISearchEndpoint: "pid": "1-71624-154-5", "title": "DATASET 50", "isPublic": True, - "creationDate": "2008-05-29T03:28:31+00:00", + "creationDate": "2008-05-29T03:28:31.000Z", "size": None, "documents": [], "techniques": [], @@ -508,7 +508,7 @@ class TestSearchAPISearchEndpoint: "pid": "1-71624-154-5", "title": "DATASET 50", "isPublic": True, - "creationDate": "2008-05-29T03:28:31+00:00", + "creationDate": "2008-05-29T03:28:31.000Z", "size": None, "documents": [], "techniques": [], @@ -539,7 +539,7 @@ class TestSearchAPISearchEndpoint: "pid": "0-468-20341-9", "title": "DATASET 6", "isPublic": True, - "creationDate": "2008-06-30T08:30:58+00:00", + "creationDate": "2008-06-30T08:30:58.000Z", "size": None, "documents": [], "techniques": [], @@ -961,9 +961,9 @@ class TestSearchAPISearchEndpoint: " cost able into western anything. Move get watch wide" " billion.", "doi": "1-202-45294-9", - "startDate": "2001-08-05T00:00:00+00:00", - "endDate": "2001-11-19T00:00:00+00:00", - "releaseDate": "2001-07-09T00:00:00+00:00", + "startDate": "2001-08-05T00:00:00.000Z", + "endDate": "2001-11-19T00:00:00.000Z", + "releaseDate": "2001-07-09T00:00:00.000Z", "license": None, "keywords": [ "wish49", @@ -1064,9 +1064,9 @@ class TestSearchAPISearchEndpoint: "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", + "startDate": "2000-04-03T00:00:00.000Z", + "endDate": "2000-07-09T00:00:00.000Z", + "releaseDate": "2000-07-05T00:00:00.000Z", "license": None, "keywords": [ "read123", @@ -1181,9 +1181,9 @@ class TestSearchAPISearchEndpoint: "\nInto with box however benefit fund economy. From among" " budget early affect kind. Item officer international.", "doi": "1-5304-9152-5", - "startDate": "2005-02-02T00:00:00+00:00", - "endDate": "2005-05-04T00:00:00+00:00", - "releaseDate": "2025-07-10T00:00:00+00:00", + "startDate": "2005-02-02T00:00:00.000Z", + "endDate": "2005-05-04T00:00:00.000Z", + "releaseDate": "2025-07-10T00:00:00.000Z", "license": None, "keywords": [ "operation292", @@ -1256,7 +1256,7 @@ class TestSearchAPISearchEndpoint: "pid": "0-236-53165-4", "title": "DATASET 100", "isPublic": True, - "creationDate": "2006-11-25T16:37:38+00:00", + "creationDate": "2006-11-25T16:37:38.000Z", "size": None, "documents": [], "techniques": [], @@ -1278,7 +1278,7 @@ class TestSearchAPISearchEndpoint: "pid": "0-9875888-6-9", "title": "DATASET 340", "isPublic": True, - "creationDate": "2006-09-30T10:38:17+00:00", + "creationDate": "2006-09-30T10:38:17.000Z", "size": None, "documents": [], "techniques": [], @@ -1310,9 +1310,9 @@ class TestSearchAPISearchEndpoint: "Quality serve food buy responsibility go much. Situation raise" " manage positive help daughter. Yes player reveal.", "doi": "0-9634101-9-9", - "startDate": "2001-02-02T00:00:00+00:00", - "endDate": "2001-05-04T00:00:00+00:00", - "releaseDate": "2001-09-26T00:00:00+00:00", + "startDate": "2001-02-02T00:00:00.000Z", + "endDate": "2001-05-04T00:00:00.000Z", + "releaseDate": "2001-09-26T00:00:00.000Z", "license": None, "keywords": [ "pressure133", @@ -1372,7 +1372,7 @@ class TestSearchAPISearchEndpoint: "pid": "1-937941-39-6", "title": "DATASET 244", "isPublic": True, - "creationDate": "2000-10-23T03:58:02+00:00", + "creationDate": "2000-10-23T03:58:02.000Z", "size": None, "documents": [], "techniques": [], @@ -1393,7 +1393,7 @@ class TestSearchAPISearchEndpoint: "pid": "1-397-29815-4", "title": "DATASET 4", "isPublic": True, - "creationDate": "2016-06-09T06:36:38+00:00", + "creationDate": "2016-06-09T06:36:38.000Z", "size": None, "documents": [], "techniques": [], From e2f1bfe1bf70bde893b7736df23b0b3708112682 Mon Sep 17 00:00:00 2001 From: github-actions Date: Fri, 18 Mar 2022 10:34:35 +0000 Subject: [PATCH 09/10] 4.3.0 Automatically generated by python-semantic-release --- CHANGELOG.md | 7 +++++++ pyproject.toml | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 386761a4..4d0e5615 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ +## v4.3.0 (2022-03-18) +### Feature +* Allow multiple datetime formats to be used when filtering in search API #338 ([`f20ad24`](https://github.com/ral-facilities/datagateway-api/commit/f20ad24886f85bb3ba70abfd29352b1a7e5c58ff)) + +### Fix +* Output datetime data in the same format as SciCat #338 ([`4596db9`](https://github.com/ral-facilities/datagateway-api/commit/4596db98808f35488aca86667aa26811d777b58e)) + ## v4.2.0 (2022-02-28) ### Feature * Create openapi endpoint for Search API #281 ([`412458c`](https://github.com/ral-facilities/datagateway-api/commit/412458cc4cc73230db0115bdbfdfe6ac815d42c1)) diff --git a/pyproject.toml b/pyproject.toml index 394468de..794a5bde 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "datagateway-api" -version = "4.2.0" +version = "4.3.0" description = "ICAT API to interface with the DataGateway" license = "Apache-2.0" readme = "README.md" From 5c1aa98206e6d8ac94ba94247b89e37b0f7ce642 Mon Sep 17 00:00:00 2001 From: Matthew Richards Date: Fri, 18 Mar 2022 10:46:53 +0000 Subject: [PATCH 10/10] ci: remove existing mysql install on GitHub Actions --- .github/workflows/ci-build.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 3a87bf1b..c56dffa5 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -54,6 +54,13 @@ jobs: - name: Change hostname to localhost run: sudo hostname -b localhost + # Remove existing MySQL installation so it doesn't interfere with GitHub Actions + - name: Remove existing mysql + run: | + sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld + sudo apt-get remove --purge "mysql*" + sudo rm -rf /var/lib/mysql* /etc/mysql + # Create local instance of ICAT - name: Run ICAT Ansible Playbook run: | @@ -215,6 +222,13 @@ jobs: - name: Change hostname to localhost run: sudo hostname -b localhost + # Remove existing MySQL installation so it doesn't interfere with GitHub Actions + - name: Remove existing mysql + run: | + sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld + sudo apt-get remove --purge "mysql*" + sudo rm -rf /var/lib/mysql* /etc/mysql + # Create local instance of ICAT - name: Run ICAT Ansible Playbook run: |