mirror of
https://github.com/GSA/notifications-api.git
synced 2026-05-05 08:40:29 -04:00
time adjustments in tests
This commit is contained in:
@@ -46,7 +46,7 @@ def mocker_get_rate(
|
||||
return Decimal(0)
|
||||
|
||||
|
||||
@freeze_time('2019-08-01')
|
||||
@freeze_time('2019-08-01T05:30')
|
||||
@pytest.mark.parametrize('day_start, expected_kwargs', [
|
||||
(None, [f'2019-07-{31-i}' for i in range(10)]),
|
||||
('2019-07-21', [f'2019-07-{21-i}' for i in range(10)]),
|
||||
@@ -77,7 +77,7 @@ def test_create_nightly_notification_status_triggers_tasks(
|
||||
mock_celery.assert_called_with(
|
||||
kwargs={
|
||||
'service_id': sample_service.id,
|
||||
'process_day': '2019-07-31',
|
||||
'process_day': '2019-07-30',
|
||||
'notification_type': SMS_TYPE
|
||||
},
|
||||
queue=QueueNames.REPORTING
|
||||
@@ -499,7 +499,7 @@ def test_create_nightly_billing_for_day_use_BST(
|
||||
|
||||
# too early
|
||||
create_notification(
|
||||
created_at=datetime(2018, 3, 25, 4, 59),
|
||||
created_at=datetime(2018, 3, 25, 3, 59),
|
||||
template=sample_template,
|
||||
status='delivered',
|
||||
rate_multiplier=1.0,
|
||||
|
||||
@@ -41,7 +41,7 @@ def test_get_month_start_and_end_date_in_utc(month, year, expected_start, expect
|
||||
(datetime(2019, 4, 1, 3, 59, 59), 2018),
|
||||
(datetime(2019, 4, 1, 4, 0, 0), 2019),
|
||||
(date(2019, 3, 31), 2018),
|
||||
(date(2019, 4, 2), 2019), # date() gives midnight UTC, which is the day before in ET
|
||||
(date(2019, 4, 2), 2019), # date() gives midnight UTC, which is the day before in ET
|
||||
])
|
||||
def test_get_financial_year_for_datetime(dt, fy):
|
||||
assert get_financial_year_for_datetime(dt) == fy
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import uuid
|
||||
from datetime import date, datetime, timedelta
|
||||
from datetime import date, datetime
|
||||
|
||||
import pytest
|
||||
from freezegun import freeze_time
|
||||
@@ -61,8 +61,8 @@ def test_get_template_usage_by_month_returns_two_templates(admin_request, sample
|
||||
template_name=PRECOMPILED_TEMPLATE_NAME,
|
||||
hidden=True
|
||||
)
|
||||
create_ft_notification_status(bst_date=datetime(2017, 4, 1), template=template_one, count=1)
|
||||
create_ft_notification_status(bst_date=datetime(2017, 4, 1), template=sample_template, count=3)
|
||||
create_ft_notification_status(bst_date=datetime(2017, 4, 2), template=template_one, count=1)
|
||||
create_ft_notification_status(bst_date=datetime(2017, 4, 2), template=sample_template, count=3)
|
||||
create_notification(sample_template, created_at=datetime.utcnow())
|
||||
|
||||
resp_json = admin_request.get(
|
||||
@@ -259,10 +259,10 @@ def test_get_monthly_notification_stats_ignores_test_keys(admin_request, sample_
|
||||
|
||||
def test_get_monthly_notification_stats_checks_dates(admin_request, sample_service):
|
||||
t = create_template(sample_service)
|
||||
create_ft_notification_status(datetime(2016, 3, 31, 12), template=t, notification_status='created')
|
||||
create_ft_notification_status(datetime(2016, 4, 1, 12), template=t, notification_status='sending')
|
||||
create_ft_notification_status(datetime(2017, 3, 31, 12), template=t, notification_status='delivered')
|
||||
create_ft_notification_status(datetime(2017, 4, 11, 12), template=t, notification_status='permanent-failure')
|
||||
create_ft_notification_status(datetime(2016, 3, 31), template=t, notification_status='created')
|
||||
create_ft_notification_status(datetime(2016, 4, 2), template=t, notification_status='sending')
|
||||
create_ft_notification_status(datetime(2017, 3, 31), template=t, notification_status='delivered')
|
||||
create_ft_notification_status(datetime(2017, 4, 11), template=t, notification_status='permanent-failure')
|
||||
|
||||
response = admin_request.get('service.get_monthly_notification_stats', service_id=sample_service.id, year=2016)
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from datetime import date, datetime, timedelta
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from freezegun import freeze_time
|
||||
|
||||
|
||||
Reference in New Issue
Block a user