From 9d720fd4bdb28571407db8bf2328184223666a77 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Thu, 30 Aug 2018 10:46:13 +0100 Subject: [PATCH] Add data to copy into beta partners spreadsheet MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently we keep track of live services in the ‘beta partners’ spreadsheet: https://docs.google.com/spreadsheets/d/1JYhE5sJaOJUVMPPDenO2eKqElC75Rygxb1_2mpRKy98/edit#gid=503930061 Every time a service goes live we need to enter some data into the spreadsheet about that service. Most of that data is copied from the request to go live ticket. This commit adds a line to the ticket with all the data needed by the spreadsheet. It’s in the same order as in the spreadsheet, and it’s tab-delimted so it should paste right on in there. --- app/main/views/service_settings.py | 21 ++++++++++++++- tests/app/main/views/test_service_settings.py | 27 ++++++++++++------- 2 files changed, 37 insertions(+), 11 deletions(-) diff --git a/app/main/views/service_settings.py b/app/main/views/service_settings.py index 2a82c39c8..1c4e7c0fd 100644 --- a/app/main/views/service_settings.py +++ b/app/main/views/service_settings.py @@ -1,3 +1,6 @@ +from datetime import datetime + +import pytz from flask import ( abort, current_app, @@ -222,6 +225,16 @@ def submit_request_to_go_live(service_id): '\nChannel: {}\nStart date: {}\nStart volume: {}' '\nPeak volume: {}' '\nFeatures: {}' + '\n' + '\n---' + '\n' + '{service_id}\t' + '{organisation}\t' + '{service_name}\t' + '{user_name}\t' + '{user_email}\t' + '-\t' + '{date}' ).format( current_service.name, url_for('main.service_dashboard', service_id=current_service.id, _external=True), @@ -239,7 +252,13 @@ def submit_request_to_go_live(service_id): 'one off' if form.method_one_off.data else None, 'file upload' if form.method_upload.data else None, 'API' if form.method_api.data else None, - )), before_each='', after_each='') + )), before_each='', after_each=''), + service_id=current_service.id, + organisation=AgreementInfo.from_current_user().owner, + service_name=current_service.name, + user_name=current_user.name, + user_email=current_user.email_address, + date=datetime.now(tz=pytz.timezone('Europe/London')).strftime('%d/%m/%Y'), ), ticket_type=zendesk_client.TYPE_QUESTION, user_email=current_user.email_address, diff --git a/tests/app/main/views/test_service_settings.py b/tests/app/main/views/test_service_settings.py index dd539d949..958636869 100644 --- a/tests/app/main/views/test_service_settings.py +++ b/tests/app/main/views/test_service_settings.py @@ -708,6 +708,7 @@ def test_should_show_request_to_go_live( ) == label +@freeze_time("2012-12-21") def test_should_redirect_after_request_to_go_live( client_request, mocker, @@ -741,16 +742,22 @@ def test_should_redirect_after_request_to_go_live( user_name=active_user_with_permissions.name, user_email=active_user_with_permissions.email_address ) - - returned_message = mock_post.call_args[1]['message'] - assert 'Service: service one' in returned_message - assert 'Organisation type: central' in returned_message - assert 'Agreement signed: Can’t tell' in returned_message - assert 'Channel: email and text messages' in returned_message - assert 'Start date: 01/01/2017' in returned_message - assert 'Start volume: 100,000' in returned_message - assert 'Peak volume: 2,000,000' in returned_message - assert 'Features: one off, file upload and API' in returned_message + assert mock_post.call_args[1]['message'] == ( + 'Service: service one\n' + 'http://localhost/services/{}\n' + '\n' + '---\n' + 'Organisation type: central\n' + 'Agreement signed: Can’t tell (domain is user.gov.uk)\n' + 'Channel: email and text messages\n' + 'Start date: 01/01/2017\n' + 'Start volume: 100,000\n' + 'Peak volume: 2,000,000\n' + 'Features: one off, file upload and API\n' + '\n' + '---\n' + '{}\tNone\tservice one\tTest User\ttest@user.gov.uk\t-\t21/12/2012' + ).format(SERVICE_ONE_ID, SERVICE_ONE_ID) assert normalize_spaces(page.select_one('.banner-default').text) == ( 'Thanks for your request to go live. We’ll get back to you within one working day.'