cleaning up from postage migration

This commit is contained in:
stvnrlly
2023-02-14 11:08:22 -05:00
parent e941ccd0cb
commit 668ab251d4
5 changed files with 70 additions and 148 deletions

View File

@@ -134,49 +134,19 @@ def test_get_data_for_billing_report(notify_db_session, admin_request):
end_date='2019-06-30'
)
# we set up 6 services, but only 4 returned. service_with_emails was skipped as it had no bills to pay,
# we set up 4 services, but only 1 returned. service_with_emails was skipped as it had no bills to pay,
# and likewise the service with SMS within allowance was skipped. too.
assert len(response) == 4
assert response[0]["organisation_id"] == str(fixtures["org_1"].id)
assert response[0]["service_id"] == str(fixtures["service_1_sms_and_letter"].id)
assert response[0]["sms_cost"] == 0
assert response[0]["sms_chargeable_units"] == 0
assert response[0]["total_letters"] == 8
assert response[0]["letter_cost"] == 3.40
assert response[0]["purchase_order_number"] == "service purchase order number"
assert response[0]["contact_names"] == "service billing contact names"
assert response[0]["contact_email_addresses"] == "service@billing.contact email@addresses.gov.uk"
assert response[0]["billing_reference"] == "service billing reference"
assert response[1]["organisation_id"] == str(fixtures["org_for_service_with_letters"].id)
assert response[1]["service_id"] == str(fixtures["service_with_letters"].id)
assert response[1]["sms_cost"] == 0
assert response[1]["sms_chargeable_units"] == 0
assert response[1]["total_letters"] == 22
assert response[1]["letter_cost"] == 14
assert response[1]["purchase_order_number"] == "org3 purchase order number"
assert response[1]["contact_names"] == "org3 billing contact names"
assert response[1]["contact_email_addresses"] == "org3@billing.contact email@addresses.gov.uk"
assert response[1]["billing_reference"] == "org3 billing reference"
assert response[2]["organisation_id"] == ""
assert response[2]["service_id"] == str(fixtures["service_with_sms_without_org"].id)
assert response[2]["sms_cost"] == 0.33
assert response[2]["sms_chargeable_units"] == 3
assert response[2]["total_letters"] == 0
assert response[2]["letter_cost"] == 0
assert response[2]["purchase_order_number"] == "sms purchase order number"
assert response[2]["contact_names"] == "sms billing contact names"
assert response[2]["contact_email_addresses"] == "sms@billing.contact email@addresses.gov.uk"
assert response[2]["billing_reference"] == "sms billing reference"
assert response[3]["organisation_id"] == ""
assert response[3]["service_id"] == str(fixtures["service_with_letters_without_org"].id)
assert response[3]["sms_cost"] == 0
assert response[3]["sms_chargeable_units"] == 0
assert response[3]["total_letters"] == 18
assert response[3]["letter_cost"] == 24.45
assert response[3]["purchase_order_number"] is None
assert len(response) == 1
assert response[0]["organisation_id"] == ""
assert response[0]["service_id"] == str(fixtures["service_with_sms_without_org"].id)
assert response[0]["sms_cost"] == 0.33
assert response[0]["sms_chargeable_units"] == 3
assert response[0]["total_letters"] == 0
assert response[0]["letter_cost"] == 0
assert response[0]["purchase_order_number"] == "sms purchase order number"
assert response[0]["contact_names"] == "sms billing contact names"
assert response[0]["contact_email_addresses"] == "sms@billing.contact email@addresses.gov.uk"
assert response[0]["billing_reference"] == "sms billing reference"
def test_daily_volumes_report(
@@ -190,11 +160,11 @@ def test_daily_volumes_report(
)
assert len(response) == 3
assert response[0] == {'day': '2022-03-01', 'email_totals': 10, 'letter_sheet_totals': 3,
'letter_totals': 2, 'sms_chargeable_units': 2, 'sms_fragment_totals': 2, 'sms_totals': 1}
assert response[1] == {'day': '2022-03-03', 'email_totals': 0, 'letter_sheet_totals': 10, 'letter_totals': 18,
assert response[0] == {'day': '2022-03-01', 'email_totals': 10, 'letter_sheet_totals': 0,
'letter_totals': 0, 'sms_chargeable_units': 2, 'sms_fragment_totals': 2, 'sms_totals': 1}
assert response[1] == {'day': '2022-03-03', 'email_totals': 0, 'letter_sheet_totals': 0, 'letter_totals': 0,
'sms_chargeable_units': 2, 'sms_fragment_totals': 2, 'sms_totals': 2}
assert response[2] == {'day': '2022-03-08', 'email_totals': 0, 'letter_sheet_totals': 11, 'letter_totals': 12,
assert response[2] == {'day': '2022-03-08', 'email_totals': 0, 'letter_sheet_totals': 0, 'letter_totals': 0,
'sms_chargeable_units': 4, 'sms_fragment_totals': 4, 'sms_totals': 2}
@@ -208,7 +178,7 @@ def test_volumes_by_service_report(
end_date='2022-03-01'
)
assert len(response) == 7
assert len(response) == 5
# since we are using a pre-set up fixture, we only care about some of the results
assert response[0] == {'email_totals': 0, 'free_allowance': 10, 'letter_cost': 0.0,
@@ -224,12 +194,12 @@ def test_volumes_by_service_report(
'service_id': str(fixture['service_with_out_ft_billing_this_year'].id),
'service_name': fixture['service_with_out_ft_billing_this_year'].name,
'sms_chargeable_units': 0, 'sms_notifications': 0}
assert response[4] == {'email_totals': 0, 'free_allowance': 10, 'letter_cost': 0.0, 'letter_sheet_totals': 0,
assert response[3] == {'email_totals': 0, 'free_allowance': 10, 'letter_cost': 0.0, 'letter_sheet_totals': 0,
'letter_totals': 0, 'organisation_id': '', 'organisation_name': '',
'service_id': str(fixture['service_with_sms_without_org'].id),
'service_name': fixture['service_with_sms_without_org'].name,
'sms_chargeable_units': 0, 'sms_notifications': 0}
assert response[6] == {'email_totals': 0, 'free_allowance': 10, 'letter_cost': 0.0, 'letter_sheet_totals': 0,
assert response[4] == {'email_totals': 0, 'free_allowance': 10, 'letter_cost': 0.0, 'letter_sheet_totals': 0,
'letter_totals': 0, 'organisation_id': '', 'organisation_name': '',
'service_id': str(fixture['service_with_sms_within_allowance'].id),
'service_name': fixture['service_with_sms_within_allowance'].name,