Changed the scheduled_for datetime to only send and hour of a day to send.

Also expect the date being passed in is BST. The date is converted to UTC before saving. And converted to BST when returning a notification.
This commit is contained in:
Rebecca Law
2017-05-17 15:06:15 +01:00
parent 5f8338dd80
commit 973cc2c4c9
14 changed files with 64 additions and 46 deletions

View File

@@ -4,8 +4,8 @@ import pytest
from app.utils import (
get_london_midnight_in_utc,
get_midnight_for_day_before,
get_utc_time_in_bst
)
convert_utc_time_in_bst,
convert_bst_to_utc)
@pytest.mark.parametrize('date, expected_date', [
@@ -32,7 +32,15 @@ def test_get_midnight_for_day_before_returns_expected_date(date, expected_date):
(datetime(2017, 3, 28, 10, 0), datetime(2017, 3, 28, 11, 0)),
(datetime(2017, 10, 28, 1, 0), datetime(2017, 10, 28, 2, 0)),
(datetime(2017, 10, 29, 1, 0), datetime(2017, 10, 29, 1, 0)),
(datetime(2017, 5, 12, 14), datetime(2017, 5, 12, 15, 0))
])
def test_get_utc_in_bst_returns_expected_date(date, expected_date):
ret_date = get_utc_time_in_bst(date)
ret_date = convert_utc_time_in_bst(date)
assert ret_date == expected_date
def test_convert_bst_to_utc():
bst = "2017-05-12 13"
bst_datetime = datetime.strptime(bst, "%Y-%m-%d %H")
utc = convert_bst_to_utc(bst_datetime)
assert utc == datetime(2017, 5, 12, 12, 0)