Refactor the get_midnight functions to return the date in UTC but for the localised time.

So in June when we are in BST June 16, 00:00 BST => June 15 23:00 UTC
This commit is contained in:
Rebecca Law
2017-01-27 15:57:25 +00:00
parent ac1ca608dd
commit c87d0a37f3
6 changed files with 32 additions and 25 deletions

View File

@@ -16,7 +16,7 @@ from app.celery.scheduled_tasks import (
send_daily_performance_stats
)
from app.dao.jobs_dao import dao_get_job_by_id
from app.utils import get_midnight_for_date
from app.utils import get_london_midnight_in_utc
from tests.app.conftest import (
sample_notification as create_sample_notification,
sample_job as create_sample_job,
@@ -211,6 +211,6 @@ def test_send_daily_performance_stats_calls_with_correct_totals(notify_db, notif
send_daily_performance_stats()
perf_mock.assert_has_calls([
call(get_midnight_for_date(yesterday), 'sms', 2, 'day'),
call(get_midnight_for_date(yesterday), 'email', 3, 'day')
call(get_london_midnight_in_utc(yesterday), 'sms', 2, 'day'),
call(get_london_midnight_in_utc(yesterday), 'email', 3, 'day')
])