Fix tests that were relying on local timezone

This commit is contained in:
Ryan Ahearn
2022-11-28 12:22:22 -05:00
parent 2f9cb5ae6d
commit 75e1975de1
2 changed files with 4 additions and 2 deletions

View File

@@ -1,10 +1,12 @@
import uuid
from collections import OrderedDict
from datetime import date
from unittest.mock import call
import pytest
from flask import url_for
from app.formatters import format_datetime_short
from tests import sample_uuid, validate_route_permission
from tests.conftest import (
SERVICE_ONE_ID,
@@ -195,7 +197,7 @@ def test_should_show_api_keys_page(
revoke_link = page.select_one('main tr a.govuk-link.govuk-link--destructive')
assert rows[0] == 'API keys Action'
assert rows[1] == 'another key name Revoked 1 January at 1:00am'
assert rows[1] == f"another key name Revoked {format_datetime_short(date.fromtimestamp(0).isoformat())}"
assert rows[2] == 'some key name Revoke some key name'
assert normalize_spaces(revoke_link.text) == 'Revoke some key name'

View File

@@ -259,7 +259,7 @@ def test_should_show_job_with_sending_limit_exceeded_status(
'No messages to show yet…'
)),
# Created a while ago, started just within the last 24h
(datetime(2020, 1, 1, 0, 0, 0), datetime(2020, 1, 9, 1, 0, 1), (
(datetime(2020, 1, 1, 0, 0, 0), datetime(2020, 1, 9, 6, 0, 1), (
'No messages to show yet…'
)),
# Created a while ago, started exactly 24h ago