Skip to content

Commit

Permalink
test_create_data encountering datetime error
Browse files Browse the repository at this point in the history
  • Loading branch information
Reillyhewitson committed Nov 3, 2022
1 parent 9cc8757 commit b31d037
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions test/datagateway_api/db/endpoints/test_create_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ def test_valid_create_data(self, flask_test_app_db, valid_db_credentials_header)
"name": f"{self.investigation_name_prefix} {i}",
"title": "Test data for the Python DB Backend on DataGateway API",
"summary": "DB Test data for DataGateway API testing",
"releaseDate": "2020-03-03 08:00:08+00:00",
"startDate": "2020-02-02 09:00:09+00:00",
"endDate": "2020-02-03 10:00:10+00:00",
"releaseDate": "2020-03-03 08:00:08",
"startDate": "2020-02-02 09:00:09",
"endDate": "2020-02-03 10:00:10",
"visitId": "Data Creation Visit DB",
"doi": "DataGateway API DB Test DOI",
"facilityID": 1,
Expand All @@ -38,6 +38,11 @@ def test_valid_create_data(self, flask_test_app_db, valid_db_credentials_header)
investigation_request.pop("id")
investigation_request.pop("modId")
investigation_request.pop("modTime")
investigation_request["endDate"] = investigation_request["endDate"][:-6]
investigation_request["releaseDate"] = investigation_request["releaseDate"][
:-6
]
investigation_request["startDate"] = investigation_request["startDate"][:-6]

assert create_investigations_json == response_json

Expand All @@ -51,9 +56,9 @@ def test_valid_boundary_create_data(
"name": f"{self.investigation_name_prefix} 0",
"title": "Test data for the Python ICAT Backend on the API",
"summary": "Test data for DataGateway API testing",
"releaseDate": "2020-03-03 08:00:08+00:00",
"startDate": "2020-02-02 09:00:09+00:00",
"endDate": "2020-02-03 10:00:10+00:00",
"releaseDate": "2020-03-03 08:00:08",
"startDate": "2020-02-02 09:00:09",
"endDate": "2020-02-03 10:00:10",
"visitId": "Data Creation Visit",
"doi": "DataGateway API Test DOI",
"facilityID": 1,
Expand All @@ -73,6 +78,9 @@ def test_valid_boundary_create_data(
response_json.pop("id")
response_json.pop("modId")
response_json.pop("modTime")
response_json["endDate"] = response_json["endDate"][:-6]
response_json["releaseDate"] = response_json["releaseDate"][:-6]
response_json["startDate"] = response_json["startDate"][:-6]

assert create_investigation_json == response_json

Expand Down

0 comments on commit b31d037

Please sign in to comment.