From a53849013a06b59edf219b966510aa34c9ca120b Mon Sep 17 00:00:00 2001 From: Pea Tyczynska Date: Fri, 3 May 2019 14:36:11 +0100 Subject: [PATCH] Add organisation type to live services csv report --- app/main/views/platform_admin.py | 3 ++- tests/app/main/views/test_platform_admin.py | 16 ++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/app/main/views/platform_admin.py b/app/main/views/platform_admin.py index b23277674..fd935ee20 100644 --- a/app/main/views/platform_admin.py +++ b/app/main/views/platform_admin.py @@ -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"], diff --git a/tests/app/main/views/test_platform_admin.py b/tests/app/main/views/test_platform_admin.py index 6cb8c965b..672fe573e 100644 --- a/tests/app/main/views/test_platform_admin.py +++ b/tests/app/main/views/test_platform_admin.py @@ -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},