From 3b564b4f29b1cac61e20c93a2c8f64f042d916f3 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Thu, 11 Jan 2018 18:26:50 +0000 Subject: [PATCH] Add option for one off in request to go live MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When we first made this form you couldn’t send one off messages with Notify. It’s interesting to us because it might help identity teams who would benefit from email auth, or other features that we build in the future for caseworkers. --- app/main/forms.py | 12 +++--------- app/main/views/service_settings.py | 9 +++++++-- .../views/service-settings/request-to-go-live.html | 7 +++++-- tests/app/main/views/test_service_settings.py | 14 ++++++++++++-- 4 files changed, 27 insertions(+), 15 deletions(-) diff --git a/app/main/forms.py b/app/main/forms.py index 9901cb89a..90171249f 100644 --- a/app/main/forms.py +++ b/app/main/forms.py @@ -534,15 +534,9 @@ class RequestToGoLiveForm(StripWhitespaceForm): 'Will the number of messages increase and when will that start?', validators=[DataRequired(message='Can’t be empty')] ) - upload_or_api = RadioField( - 'How are you going to send messages?', - choices=[ - ('File upload', 'Upload a spreadsheet of recipients'), - ('API', 'Integrate with the GOV.UK Notify API'), - ('API and file upload', 'Both') - ], - validators=[DataRequired()] - ) + method_one_off = BooleanField('One at a time') + method_upload = BooleanField('Upload a spreadsheet of recipients') + method_api = BooleanField('Integrate with the GOV.UK Notify API') class ProviderForm(StripWhitespaceForm): diff --git a/app/main/views/service_settings.py b/app/main/views/service_settings.py index 5b585f1ce..0b172f61e 100644 --- a/app/main/views/service_settings.py +++ b/app/main/views/service_settings.py @@ -165,7 +165,8 @@ def service_request_to_go_live(service_id): '\nOrganisation type: {} ({:,} free text messages)' '\nMOU in place: {}' '\nChannel: {}\nStart date: {}\nStart volume: {}' - '\nPeak volume: {}\nUpload or API: {}' + '\nPeak volume: {}' + '\nFeatures: {}' ).format( current_service['name'], url_for('main.service_dashboard', service_id=current_service['id'], _external=True), @@ -180,7 +181,11 @@ def service_request_to_go_live(service_id): form.start_date.data, form.start_volume.data, form.peak_volume.data, - form.upload_or_api.data + formatted_list(filter(None, ( + '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='') ) } diff --git a/app/templates/views/service-settings/request-to-go-live.html b/app/templates/views/service-settings/request-to-go-live.html index 8563f4cf5..ac0722fb5 100644 --- a/app/templates/views/service-settings/request-to-go-live.html +++ b/app/templates/views/service-settings/request-to-go-live.html @@ -44,9 +44,12 @@ {{ textbox(form.start_date, width='1-1') }} {{ textbox(form.start_volume, width='1-1', hint='For example, ‘1000 a month’.') }} {{ textbox(form.peak_volume, width='1-1', hint='For example, ‘Messages will increase to 20,000 a month in January’.') }} - {{ radios(form.upload_or_api) }} - + {{ checkbox_group('How are you going to send messages?', [ + form.method_one_off, + form.method_upload, + form.method_api + ]) }}

Once you’ve completed the tasks needed to set up, we’ll make your service live. We’ll do this within one working day.

diff --git a/tests/app/main/views/test_service_settings.py b/tests/app/main/views/test_service_settings.py index 0643f5479..cd9c719a8 100644 --- a/tests/app/main/views/test_service_settings.py +++ b/tests/app/main/views/test_service_settings.py @@ -434,6 +434,14 @@ def test_should_show_request_to_go_live( assert normalize_spaces( page.select_one('label[for=channel_{}]'.format(channel)).text ) == label + for feature, label in ( + ('one_off', 'One at a time'), + ('upload', 'Upload a spreadsheet of recipients'), + ('api', 'Integrate with the GOV.UK Notify API'), + ): + assert normalize_spaces( + page.select_one('label[for=method_{}]'.format(feature)).text + ) == label def test_should_redirect_after_request_to_go_live( @@ -459,7 +467,9 @@ def test_should_redirect_after_request_to_go_live( 'start_date': '01/01/2017', 'start_volume': '100,000', 'peak_volume': '2,000,000', - 'upload_or_api': 'API' + 'method_one_off': 'y', + 'method_upload': 'y', + 'method_api': 'y', }, _follow_redirects=True ) @@ -483,7 +493,7 @@ def test_should_redirect_after_request_to_go_live( 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 'Upload or API: API' in returned_message + assert 'Features: one off, file upload and API' in returned_message assert normalize_spaces(page.select_one('.banner-default').text) == ( 'We’ve received your request to go live'