clean up remaining todays()

This commit is contained in:
Kenneth Kehl
2023-05-31 10:07:27 -07:00
parent 38461af5ae
commit 80c6c677db
4 changed files with 7 additions and 7 deletions

View File

@@ -426,7 +426,7 @@ def test_create_nightly_notification_status_for_service_and_day(notify_db_sessio
second_service = create_service(service_name='second Service')
second_template = create_template(service=second_service, template_type='email')
process_day = date.today() - timedelta(days=5)
process_day = datetime.utcnow().date() - timedelta(days=5)
with freeze_time(datetime.combine(process_day, time.max)):
create_notification(template=first_template, status='delivered')
create_notification(template=second_template, status='temporary-failure')
@@ -441,7 +441,7 @@ def test_create_nightly_notification_status_for_service_and_day(notify_db_sessio
create_notification_history(template=second_template, status='delivered')
# these created notifications from a different day get ignored
with freeze_time(datetime.combine(date.today() - timedelta(days=4), time.max)):
with freeze_time(datetime.combine(datetime.utcnow().date() - timedelta(days=4), time.max)):
create_notification(template=first_template)
create_notification_history(template=second_template)

View File

@@ -1,5 +1,5 @@
import json
from datetime import date
from datetime import date, datetime
from flask import url_for
from freezegun import freeze_time
@@ -74,7 +74,7 @@ def test_get_complaint_sets_start_and_end_date_to_today_if_not_specified(mocker,
dao_mock = mocker.patch('app.complaint.complaint_rest.fetch_count_of_complaints', return_value=5)
response = client.get(url_for('complaint.get_complaint_count'), headers=[create_admin_authorization_header()])
dao_mock.assert_called_once_with(start_date=date.today(), end_date=date.today())
dao_mock.assert_called_once_with(start_date=datetime.utcnow().date(), end_date=datetime.utcnow().date())
assert response.status_code == 200
assert json.loads(response.get_data(as_text=True)) == 5

View File

@@ -714,7 +714,7 @@ def test_fetch_usage_year_for_organisation_only_queries_present_year(notify_db_s
last_year = current_year - 1
date_two_years_ago = date(2021, 3, 31)
date_in_last_financial_year = date(2022, 3, 31)
date_in_this_year = date.today()
date_in_this_year = datetime.utcnow().date()
org = create_organisation(name='Organisation 1')