diff --git a/tests/app/dao/test_monthly_billing.py b/tests/app/dao/test_monthly_billing.py index a1d5bef7d..e09814708 100644 --- a/tests/app/dao/test_monthly_billing.py +++ b/tests/app/dao/test_monthly_billing.py @@ -153,10 +153,15 @@ def test_add_monthly_billing_for_single_month_populates_correctly( sample_template, sample_email_template ): create_rate(start_date=JAN_2017_MONTH_START, value=0.0158, notification_type=SMS_TYPE) + letter_template = sample_letter_template(sample_template.service) + create_letter_rate(crown=False) create_notification( template=sample_template, created_at=JAN_2017_MONTH_START, billable_units=1, rate_multiplier=2, status='delivered' ) + create_notification(template=sample_email_template, created_at=JAN_2017_MONTH_START, + status='delivered') + create_notification(template=letter_template, created_at=JAN_2017_MONTH_START, status='delivered') create_or_update_monthly_billing( service_id=sample_template.service_id, @@ -169,7 +174,14 @@ def test_add_monthly_billing_for_single_month_populates_correctly( _assert_monthly_billing( monthly_billing[0], sample_template.service.id, 'email', JAN_2017_MONTH_START, JAN_2017_MONTH_END ) - assert monthly_billing[0].monthly_totals == [] + _assert_monthly_billing_totals( + monthly_billing[0].monthly_totals[0], { + "billing_units": 1, + "rate_multiplier": 1, + "international": False, + "rate": 0.0, + "total_cost": 0 + }) _assert_monthly_billing( monthly_billing[1], sample_template.service.id, 'sms', JAN_2017_MONTH_START, JAN_2017_MONTH_END @@ -185,11 +197,17 @@ def test_add_monthly_billing_for_single_month_populates_correctly( _assert_monthly_billing( monthly_billing[2], sample_template.service.id, 'letter', JAN_2017_MONTH_START, JAN_2017_MONTH_END ) - assert monthly_billing[2].monthly_totals == [] + _assert_monthly_billing_totals(monthly_billing[2].monthly_totals[0], { + "billing_units": 1, + "rate_multiplier": 1, + "international": False, + "rate": 0.31, + "total_cost": 1 * 0.31 + }) def test_add_monthly_billing_for_multiple_months_populate_correctly( - sample_template, sample_email_template + sample_template ): create_rate(start_date=FEB_2016_MONTH_START - timedelta(days=1), value=0.12, notification_type=SMS_TYPE) create_notification(