Skip to content

Commit

Permalink
feat: Changes to tests so they pass with icat 5
Browse files Browse the repository at this point in the history
  • Loading branch information
Reillyhewitson committed Sep 22, 2022
1 parent 8eb3ea4 commit 73f3c77
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions datagateway_api/src/datagateway_api/database/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,8 @@ class INVESTIGATION(Base, EntityHelper, metaclass=EntityMeta):
typeID = Column(
"TYPE_ID", ForeignKey("INVESTIGATIONTYPE.ID"), nullable=False, index=True,
)
fileSize = Column("FILESIZE", BigInteger)
fileCount = Column("FILECOUNT", BigInteger)

FACILITY = relationship(
"FACILITY",
Expand Down
2 changes: 2 additions & 0 deletions test/datagateway_api/db/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ def create_investigation_db_data(num_entities=1):
investigation.visitId = str(uuid.uuid1())
investigation.facilityID = 1
investigation.typeID = 1
investigation.fileSize = 1073741824
investigation.fileCount = 3

set_meta_attributes(investigation)

Expand Down
2 changes: 2 additions & 0 deletions test/datagateway_api/db/test_entity_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ def test_valid_to_dict(self, datafile_entity):
"id": None,
"createId": None,
"createTime": None,
"fileCount": None,
"fileSize": None,
"doi": None,
"endDate": None,
"modId": None,
Expand Down
2 changes: 2 additions & 0 deletions test/datagateway_api/icat/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ def create_investigation_test_data(client, num_entities=1):
investigation.endDate = datetime(
year=2020, month=1, day=8, hour=1, minute=1, second=1, tzinfo=tzlocal(),
)
investigation.fileSize = 1073741824
investigation.fileCount = 3
# UUID visit ID means uniquesness constraint should always be met
investigation.visitId = str(uuid.uuid1())
investigation.facility = client.get("Facility", 1)
Expand Down
4 changes: 4 additions & 0 deletions test/datagateway_api/icat/endpoints/test_create_icat.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ def test_valid_create_data(
"doi": "DataGateway API Test DOI",
"facility": 1,
"type": 1,
"fileCount": 1,
"fileSize": 6,
}
for i in range(2)
]
Expand Down Expand Up @@ -60,6 +62,8 @@ def test_valid_boundary_create_data(
"doi": "DataGateway API Test DOI",
"facility": 1,
"type": 1,
"fileCount": 3,
"fileSize": 2,
}

test_response = flask_test_app_icat.post(
Expand Down
6 changes: 6 additions & 0 deletions test/datagateway_api/icat/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ def test_invalid_query_creation(self, icat_client):
{
"doi": None,
"endDate": "2020-01-08 01:01:01+00:00",
"fileCount": 3,
"fileSize": 1073741824,
"name": "Test Data for DataGateway API Testing 0",
"releaseDate": None,
"startDate": "2020-01-04 01:01:01+00:00",
Expand Down Expand Up @@ -164,6 +166,8 @@ def test_invalid_query_creation(self, icat_client):
"summary": None,
"title": "Test data for the Python ICAT Backend on DataGateway"
" API 0",
"fileCount": 3,
"fileSize": 1073741824,
"facility": {
"createId": "user",
"createTime": "2002-11-27 06:20:36+00:00",
Expand Down Expand Up @@ -207,6 +211,8 @@ def test_invalid_query_creation(self, icat_client):
{
"doi": None,
"endDate": "2020-01-08 01:01:01+00:00",
"fileCount": 3,
"fileSize": 1073741824,
"name": "Test Data for DataGateway API Testing 0",
"releaseDate": None,
"startDate": "2020-01-04 01:01:01+00:00",
Expand Down

0 comments on commit 73f3c77

Please sign in to comment.