mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-08 17:53:12 -04:00
Fix tests that were relying on local timezone
This commit is contained in:
@@ -1,10 +1,12 @@
|
|||||||
import uuid
|
import uuid
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
from datetime import date
|
||||||
from unittest.mock import call
|
from unittest.mock import call
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from flask import url_for
|
from flask import url_for
|
||||||
|
|
||||||
|
from app.formatters import format_datetime_short
|
||||||
from tests import sample_uuid, validate_route_permission
|
from tests import sample_uuid, validate_route_permission
|
||||||
from tests.conftest import (
|
from tests.conftest import (
|
||||||
SERVICE_ONE_ID,
|
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')
|
revoke_link = page.select_one('main tr a.govuk-link.govuk-link--destructive')
|
||||||
|
|
||||||
assert rows[0] == 'API keys Action'
|
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 rows[2] == 'some key name Revoke some key name'
|
||||||
|
|
||||||
assert normalize_spaces(revoke_link.text) == 'Revoke some key name'
|
assert normalize_spaces(revoke_link.text) == 'Revoke some key name'
|
||||||
|
|||||||
@@ -259,7 +259,7 @@ def test_should_show_job_with_sending_limit_exceeded_status(
|
|||||||
'No messages to show yet…'
|
'No messages to show yet…'
|
||||||
)),
|
)),
|
||||||
# Created a while ago, started just within the last 24h
|
# 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…'
|
'No messages to show yet…'
|
||||||
)),
|
)),
|
||||||
# Created a while ago, started exactly 24h ago
|
# Created a while ago, started exactly 24h ago
|
||||||
|
|||||||
Reference in New Issue
Block a user