Merge pull request #2952 from alphagov/fix-live-services-csv

Add organisation type to live services csv report
This commit is contained in:
Pea (Malgorzata Tyczynska)
2019-05-03 15:48:50 +01:00
committed by GitHub
2 changed files with 10 additions and 9 deletions

View File

@@ -204,7 +204,7 @@ def platform_admin_reports():
def live_services_csv():
results = service_api_client.get_live_services_data()["data"]
live_services_columns = [
"Service ID", "Organisation", "Service name", "Consent to research", "Main contact",
"Service ID", "Organisation", "Organisation type", "Service name", "Consent to research", "Main contact",
"Contact email", "Contact mobile", "Live date", "SMS volume intent", "Email volume intent",
"Letter volume intent", "SMS sent this year", "Emails sent this year", "Letters sent this year"
]
@@ -214,6 +214,7 @@ def live_services_csv():
live_services_data.append([
row["service_id"],
row["organisation_name"],
row["organisation_type"],
row["service_name"],
row["consent_to_research"],
row["contact_name"],

View File

@@ -958,12 +958,12 @@ def test_get_live_services_report(client, platform_admin_user, mocker):
'app.service_api_client.get_live_services_data',
return_value={'data': [
{'service_id': 1, 'service_name': 'jessie the oak tree', 'organisation_name': 'Forest',
'consent_to_research': True, 'contact_name': 'Forest fairy',
'consent_to_research': True, 'contact_name': 'Forest fairy', 'organisation_type': 'Ecosystem',
'contact_email': 'forest.fairy@digital.cabinet-office.gov.uk', 'contact_mobile': '+447700900986',
'live_date': 'Sat, 29 Mar 2014 00:00:00 GMT', 'sms_volume_intent': 100, 'email_volume_intent': 50,
'letter_volume_intent': 20, 'sms_totals': 300, 'email_totals': 1200, 'letter_totals': 0},
{'service_id': 2, 'service_name': 'james the pine tree', 'organisation_name': 'Forest',
'consent_to_research': None, 'contact_name': None,
'consent_to_research': None, 'contact_name': None, 'organisation_type': 'Ecosystem',
'contact_email': None, 'contact_mobile': None,
'live_date': None, 'sms_volume_intent': None, 'email_volume_intent': 60,
'letter_volume_intent': 0, 'sms_totals': 0, 'email_totals': 0, 'letter_totals': 0},
@@ -973,11 +973,11 @@ def test_get_live_services_report(client, platform_admin_user, mocker):
assert response.status_code == 200
report = response.get_data(as_text=True)
assert report.strip() == (
'Service ID,Organisation,Service name,Consent to research,Main contact,Contact email,Contact mobile,'
+ 'Live date,SMS volume intent,Email volume intent,Letter volume intent,SMS sent this year,'
+ 'Emails sent this year,Letters sent this year\r\n1,Forest,jessie the oak tree,True,Forest fairy,'
'Service ID,Organisation,Organisation type,Service name,Consent to research,Main contact,Contact email,'
+ 'Contact mobile,Live date,SMS volume intent,Email volume intent,Letter volume intent,SMS sent this year,'
+ 'Emails sent this year,Letters sent this year\r\n1,Forest,Ecosystem,jessie the oak tree,True,Forest fairy,'
+ 'forest.fairy@digital.cabinet-office.gov.uk,+447700900986,29-03-2014,100,50,20,300,1200,0\r\n2,Forest,'
+ 'james the pine tree,,,,,,,60,0,0,0,0'
+ 'Ecosystem,james the pine tree,,,,,,,60,0,0,0,0'
)
@@ -989,12 +989,12 @@ def test_get_performance_platform_report(client, platform_admin_user, mocker):
'app.service_api_client.get_live_services_data',
return_value={'data': [
{'service_id': 1, 'service_name': 'jessie the oak tree', 'organisation_name': 'Forest',
'consent_to_research': True, 'contact_name': 'Forest fairy',
'consent_to_research': True, 'contact_name': 'Forest fairy', 'organisation_type': 'Ecosystem',
'contact_email': 'forest.fairy@digital.cabinet-office.gov.uk', 'contact_mobile': '+447700900986',
'live_date': 'Sat, 29 Mar 2014 00:00:00 GMT', 'sms_volume_intent': 100, 'email_volume_intent': 50,
'letter_volume_intent': 20, 'sms_totals': 300, 'email_totals': 1200, 'letter_totals': 0},
{'service_id': 2, 'service_name': 'james the pine tree', 'organisation_name': 'Forest',
'consent_to_research': None, 'contact_name': None,
'consent_to_research': None, 'contact_name': None, 'organisation_type': 'Ecosystem',
'contact_email': None, 'contact_mobile': None,
'live_date': None, 'sms_volume_intent': None, 'email_volume_intent': 60,
'letter_volume_intent': 0, 'sms_totals': 0, 'email_totals': 0, 'letter_totals': 0},