diff --git a/app/models.py b/app/models.py index 682e8bd83..296203d5b 100644 --- a/app/models.py +++ b/app/models.py @@ -1297,6 +1297,7 @@ NOTIFICATION_STATUS_TYPES_BILLABLE = [ NOTIFICATION_SENDING, NOTIFICATION_SENT, NOTIFICATION_DELIVERED, + NOTIFICATION_PENDING, NOTIFICATION_FAILED, NOTIFICATION_TEMPORARY_FAILURE, NOTIFICATION_PERMANENT_FAILURE, diff --git a/tests/app/dao/test_ft_billing_dao.py b/tests/app/dao/test_ft_billing_dao.py index 3b5554405..2216a96f7 100644 --- a/tests/app/dao/test_ft_billing_dao.py +++ b/tests/app/dao/test_ft_billing_dao.py @@ -59,19 +59,20 @@ def set_up_yearly_data(): def test_fetch_billing_data_for_today_includes_data_with_the_right_status(notify_db_session): + today = convert_utc_to_bst(datetime.utcnow()) service = create_service() template = create_template(service=service, template_type="email") + for status in ['created', 'technical-failure']: create_notification(template=template, status=status) - - today = convert_utc_to_bst(datetime.utcnow()) results = fetch_billing_data_for_day(today.date()) assert results == [] - for status in ['delivered', 'sending', 'temporary-failure']: + + for status in ['delivered', 'sending', 'temporary-failure', 'pending']: create_notification(template=template, status=status) results = fetch_billing_data_for_day(today.date()) assert len(results) == 1 - assert results[0].notifications_sent == 3 + assert results[0].notifications_sent == 4 def test_fetch_billing_data_for_today_includes_data_with_the_right_key_type(notify_db_session): @@ -299,8 +300,8 @@ def test_fetch_billing_data_for_day_bills_correctly_for_status(notify_db_session sms_results = [x for x in results if x[2] == 'sms'] email_results = [x for x in results if x[2] == 'email'] letter_results = [x for x in results if x[2] == 'letter'] - assert 7 == sms_results[0][7] - assert 7 == email_results[0][7] + assert 8 == sms_results[0][7] + assert 8 == email_results[0][7] assert 3 == letter_results[0][7]