notify-136 change financial year starting in april to calendar year (#278)

Co-authored-by: Kenneth Kehl <@kkehl@flexion.us>
This commit is contained in:
Kenneth Kehl
2023-06-14 13:19:11 -07:00
committed by GitHub
parent e9fccc8493
commit 9f9e0a6ad8
16 changed files with 96 additions and 97 deletions

View File

@@ -249,17 +249,16 @@ def test_get_monthly_notification_stats_ignores_test_keys(admin_request, sample_
def test_get_monthly_notification_stats_checks_dates(admin_request, sample_service):
t = create_template(sample_service)
create_ft_notification_status(datetime(2016, 3, 31), template=t, notification_status='created')
# create_ft_notification_status(datetime(2016, 3, 31), template=t, notification_status='created')
create_ft_notification_status(datetime(2016, 4, 2), template=t, notification_status='sending')
create_ft_notification_status(datetime(2017, 3, 31), template=t, notification_status='delivered')
create_ft_notification_status(datetime(2017, 4, 11), template=t, notification_status='permanent-failure')
response = admin_request.get('service.get_monthly_notification_stats', service_id=sample_service.id, year=2016)
assert '2016-03' not in response['data']
assert '2016-04' in response['data']
assert '2017-04' not in response['data']
assert response['data']['2016-04']['sms'] == {'sending': 1}
assert response['data']['2017-03']['sms'] == {'delivered': 1}
assert response['data']['2016-04']['sms'] == {'sending': 1}
def test_get_monthly_notification_stats_only_gets_for_one_service(admin_request, notify_db_session):

View File

@@ -1,16 +1,16 @@
from freezegun import freeze_time
from app.dao.date_util import get_current_financial_year_start_year
from app.dao.date_util import get_current_calendar_year_start_year
# see get_financial_year for conversion of financial years.
@freeze_time("2017-03-31 23:59:59.999999")
def test_get_current_financial_year_start_year_before_march():
current_fy = get_current_financial_year_start_year()
assert current_fy == 2016
def test_get_current_calendar_year_start_year_before_march():
current_fy = get_current_calendar_year_start_year()
assert current_fy == 2017
@freeze_time("2017-04-01 04:00:00.000000")
def test_get_current_financial_year_start_year_after_april():
current_fy = get_current_financial_year_start_year()
def test_get_current_calendar_year_start_year_after_april():
current_fy = get_current_calendar_year_start_year()
assert current_fy == 2017