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

@@ -1,5 +1,4 @@
from datetime import datetime, timedelta, date
import pytz
import uuid
from functools import partial
@@ -47,7 +46,7 @@ from app.dao.notifications_dao import (
from app.dao.services_dao import dao_update_service
from app.utils import (
get_midnight_for_date,
get_london_midnight_in_utc,
get_midnight_for_day_before
)
@@ -1489,7 +1488,7 @@ def test_get_total_sent_notifications_yesterday_returns_expected_totals_dict(
assert total_count_dict == {
"start_date": get_midnight_for_day_before(datetime.utcnow()),
"end_date": get_midnight_for_date(datetime.utcnow()),
"end_date": get_london_midnight_in_utc(datetime.utcnow()),
"email": {
"count": 3
},