From dd113a8e86e4724811197dda573ceffce36cf3bc Mon Sep 17 00:00:00 2001 From: Rebecca Law Date: Tue, 8 May 2018 13:44:06 +0100 Subject: [PATCH] Update the tests so that they ignore timezone in the month returned by query. The timezone added is that of the database - locally a db will get timezone=GB, but the servers are using UTC (which is right) This date is trucated to month, and is BST, here time and timezone is irrelevant. --- tests/app/dao/test_ft_billing_dao.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/app/dao/test_ft_billing_dao.py b/tests/app/dao/test_ft_billing_dao.py index 45ad4cc0a..2f7eef368 100644 --- a/tests/app/dao/test_ft_billing_dao.py +++ b/tests/app/dao/test_ft_billing_dao.py @@ -221,14 +221,14 @@ def test_fetch_monthly_billing_for_year(notify_db_session): results = fetch_monthly_billing_for_year(service_id=service.id, year=2018) assert len(results) == 2 - assert str(results[0].month) == "2018-06-01 00:00:00+01:00" + assert str(results[0].month.date()) == "2018-06-01" assert results[0].notifications_sent == 30 assert results[0].billable_units == Decimal('60') assert results[0].service_id == service.id assert results[0].rate == Decimal('0.162') assert results[0].notification_type == 'sms' - assert str(results[1].month) == "2018-07-01 00:00:00+01:00" + assert str(results[1].month.date()) == "2018-07-01" assert results[1].notifications_sent == 31 assert results[1].billable_units == Decimal('31') assert results[1].service_id == service.id @@ -287,20 +287,20 @@ def test_fetch_monthly_billing_for_year_return_financial_year(notify_db_session) # Orders by Month assert len(results) == 36 - assert str(results[0].month) == "2016-04-01 00:00:00+01:00" + assert str(results[0].month.date()) == "2016-04-01" assert results[0].notification_type == 'email' assert results[0].notifications_sent == 30 assert results[0].billable_units == 30 assert results[0].rate == Decimal('0') - assert str(results[1].month) == "2016-04-01 00:00:00+01:00" + assert str(results[1].month.date()) == "2016-04-01" assert results[1].notification_type == 'letter' assert results[1].notifications_sent == 30 assert results[1].billable_units == 30 assert results[1].rate == Decimal('0.33') - assert str(results[2].month) == "2016-04-01 00:00:00+01:00" + assert str(results[2].month.date()) == "2016-04-01" assert results[2].notification_type == 'sms' assert results[2].notifications_sent == 30 assert results[2].billable_units == 30 assert results[2].rate == Decimal('0.162') - assert str(results[3].month) == "2016-05-01 00:00:00+01:00" - assert str(results[35].month) == "2017-03-01 00:00:00+00:00" + assert str(results[3].month.date()) == "2016-05-01" + assert str(results[35].month.date()) == "2017-03-01"