Skip to content

Commit

Permalink
Add check on created and modified times in systems e2e tests #90
Browse files Browse the repository at this point in the history
  • Loading branch information
joelvdavies committed Jun 26, 2024
1 parent 687163a commit 70bb4dd
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/e2e/test_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
End-to-End tests for the System router
"""

from datetime import datetime
from test.conftest import add_ids_to_properties
from test.e2e.conftest import replace_unit_values_with_ids_in_properties
from test.e2e.mock_schemas import USAGE_STATUS_POST_B
Expand Down Expand Up @@ -373,6 +374,17 @@ def check_patch_system_response_success(self, expected_system_get_data: dict):
assert self._patch_response.status_code == 200
assert self._patch_response.json() == expected_system_get_data

# pylint:disable=fixme
# TODO: Move the below code into a utility or something later - will be wanted for other tests?
original_data = self._post_response.json()
new_data = self._patch_response.json()

# Created time should be unchanged, but new modified time should be greater than before
assert original_data["created_time"] == new_data["created_time"]
assert datetime.fromisoformat(new_data["modified_time"]) > datetime.fromisoformat(
original_data["modified_time"]
)

def check_patch_system_failed_with_message(self, status_code: int, detail: str):
"""Checks that a prior call to 'patch_system' gave a failed response with the expected code and error message"""

Expand Down

0 comments on commit 70bb4dd

Please sign in to comment.