Skip to content
Snippets Groups Projects
Commit 67d77367 authored by Robert Goldmann's avatar Robert Goldmann
Browse files

tests should be more robust against current date and time

parent 23d2b9a7
Branches
Tags
No related merge requests found
......@@ -80,6 +80,9 @@ class TestSendNotification:
def test_already_notified_should_skip_sending(self, requestsMock):
tile = GarbageContainerScheduleTile('myGarbageScheduleTile', example_settings(True), 10)
with mock.patch.object(tile, '_get_current_date_time',
wraps=tile._get_current_date_time) as currentDateTimeMock:
currentDateTimeMock.return_value = datetime(year=2021, month=3, day=21, hour=11, minute=00, second=0)
requestsMock.post.return_value.status_code = 200
tile._send_notification(1, '')
tile._send_notification(1, '')
......@@ -90,6 +93,9 @@ class TestSendNotification:
def test_already_notified_should_skip_sending_even_if_already_skipped_before(self, requestsMock):
tile = GarbageContainerScheduleTile('myGarbageScheduleTile', example_settings(True), 10)
with mock.patch.object(tile, '_get_current_date_time',
wraps=tile._get_current_date_time) as currentDateTimeMock:
currentDateTimeMock.return_value = datetime(year=2021, month=3, day=21, hour=11, minute=00, second=0)
requestsMock.post.return_value.status_code = 200
tile._send_notification(1, '')
tile._send_notification(1, '')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment