remove letters from platform_stats

This commit is contained in:
stvnrlly
2023-02-24 13:35:58 -05:00
parent 030d22bd6d
commit 0a3260c030
4 changed files with 38 additions and 64 deletions

View File

@@ -72,11 +72,6 @@ def test_get_platform_stats_with_real_query(admin_request, notify_db_session):
'virus-scan-failed': 0, 'temporary-failure': 0, 'permanent-failure': 0, 'technical-failure': 0},
'total': 4, 'test-key': 0
},
'letter': {
'failures': {
'virus-scan-failed': 0, 'temporary-failure': 0, 'permanent-failure': 0, 'technical-failure': 0},
'total': 0, 'test-key': 0
},
'sms': {
'failures': {
'virus-scan-failed': 0, 'temporary-failure': 0, 'permanent-failure': 0, 'technical-failure': 0},
@@ -141,8 +136,6 @@ def test_get_data_for_billing_report(notify_db_session, admin_request):
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"
@@ -160,11 +153,11 @@ def test_daily_volumes_report(
)
assert len(response) == 3
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,
assert response[0] == {'day': '2022-03-01', 'email_totals': 10,
'sms_chargeable_units': 2, 'sms_fragment_totals': 2, 'sms_totals': 1}
assert response[1] == {'day': '2022-03-03', 'email_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': 0, 'letter_totals': 0,
assert response[2] == {'day': '2022-03-08', 'email_totals': 0,
'sms_chargeable_units': 4, 'sms_fragment_totals': 4, 'sms_totals': 2}
@@ -181,26 +174,22 @@ def test_volumes_by_service_report(
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,
'letter_sheet_totals': 0, 'letter_totals': 0,
assert response[0] == {'email_totals': 0, 'free_allowance': 10,
'organisation_id': str(fixture['org_1'].id),
'organisation_name': fixture['org_1'].name,
'service_id': str(fixture['service_1_sms_and_letter'].id),
'service_name': fixture['service_1_sms_and_letter'].name,
'sms_chargeable_units': 2, 'sms_notifications': 1}
assert response[1] == {'email_totals': 0, 'free_allowance': 10, 'letter_cost': 0.0, 'letter_sheet_totals': 0,
'letter_totals': 0, 'organisation_id': str(fixture['org_1'].id),
assert response[1] == {'email_totals': 0, 'free_allowance': 10, 'organisation_id': str(fixture['org_1'].id),
'organisation_name': fixture['org_1'].name,
'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[3] == {'email_totals': 0, 'free_allowance': 10, 'letter_cost': 0.0, 'letter_sheet_totals': 0,
'letter_totals': 0, 'organisation_id': '', 'organisation_name': '',
assert response[3] == {'email_totals': 0, 'free_allowance': 10, '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[4] == {'email_totals': 0, 'free_allowance': 10, 'letter_cost': 0.0, 'letter_sheet_totals': 0,
'letter_totals': 0, 'organisation_id': '', 'organisation_name': '',
assert response[4] == {'email_totals': 0, 'free_allowance': 10, 'organisation_id': '', 'organisation_name': '',
'service_id': str(fixture['service_with_sms_within_allowance'].id),
'service_name': fixture['service_with_sms_within_allowance'].name,
'sms_chargeable_units': 0, 'sms_notifications': 0}

View File

@@ -95,12 +95,6 @@ def test_create_stats_dict():
'permanent-failure': 0,
'temporary-failure': 0,
'virus-scan-failed': 0}},
'letter': {'total': 0,
'test-key': 0,
'failures': {'technical-failure': 0,
'permanent-failure': 0,
'temporary-failure': 0,
'virus-scan-failed': 0}}
}
@@ -108,7 +102,6 @@ def test_format_admin_stats_only_includes_test_key_notifications_in_test_key_sec
rows = [
NewStatsRow('email', 'technical-failure', 'test', 3),
NewStatsRow('sms', 'permanent-failure', 'test', 4),
NewStatsRow('letter', 'virus-scan-failed', 'test', 5),
]
stats_dict = format_admin_stats(rows)
@@ -120,10 +113,6 @@ def test_format_admin_stats_only_includes_test_key_notifications_in_test_key_sec
assert stats_dict['sms']['failures']['permanent-failure'] == 0
assert stats_dict['sms']['test-key'] == 4
assert stats_dict['letter']['total'] == 0
assert stats_dict['letter']['failures']['virus-scan-failed'] == 0
assert stats_dict['letter']['test-key'] == 5
def test_format_admin_stats_counts_non_test_key_notifications_correctly():
rows = [
@@ -131,7 +120,6 @@ def test_format_admin_stats_counts_non_test_key_notifications_correctly():
NewStatsRow('email', 'created', 'team', 3),
NewStatsRow('sms', 'temporary-failure', 'normal', 6),
NewStatsRow('sms', 'sent', 'normal', 2),
NewStatsRow('letter', 'pending-virus-check', 'normal', 1),
]
stats_dict = format_admin_stats(rows)
@@ -141,8 +129,6 @@ def test_format_admin_stats_counts_non_test_key_notifications_correctly():
assert stats_dict['sms']['total'] == 8
assert stats_dict['sms']['failures']['permanent-failure'] == 0
assert stats_dict['letter']['total'] == 1
def _stats(requested, delivered, failed):
return {'requested': requested, 'delivered': delivered, 'failed': failed}