Merge pull request #1006 from alphagov/request-to-go-live-improvements

Make certain questions on request to go live radio buttons
This commit is contained in:
Chris Hill-Scott
2016-11-04 14:05:54 +01:00
committed by GitHub
4 changed files with 54 additions and 31 deletions
+30 -9
View File
@@ -384,26 +384,47 @@ class Feedback(Form):
class RequestToGoLiveForm(Form): class RequestToGoLiveForm(Form):
channel = StringField( mou = RadioField(
'Are you sending emails or text messages or both?', (
validators=[DataRequired(message='Cant be empty')] 'Has your organisation accepted the GOV.UK Notify data sharing and financial '
'agreement (Memorandum of Understanding)?'
),
choices=[
('yes', 'Yes'),
('no', 'No well send you a copy'),
('dont know', 'I dont know well check for you')
],
validators=[DataRequired()]
)
channel = RadioField(
'What kind of messages will you be sending?',
choices=[
('emails', 'Emails'),
('text messages', 'Text messages'),
('emails and text messages', 'Both')
],
validators=[DataRequired()]
) )
start_date = StringField( start_date = StringField(
'When will you be ready to start sending messages?', 'When will you be ready to start sending messages?',
validators=[DataRequired(message='Cant be empty')] validators=[DataRequired(message='Cant be empty')]
) )
start_volume = StringField( start_volume = StringField(
'How many messages do you expect to send per month to start with? Give an estimate in numbers.', 'How many messages do you expect to send to start with?',
validators=[DataRequired(message='Cant be empty')] validators=[DataRequired(message='Cant be empty')]
) )
peak_volume = StringField( peak_volume = StringField(
'Will the number of messages a month increase and when will that start? Give an estimate.', 'Will the number of messages increase and when will that start?',
validators=[DataRequired(message='Cant be empty')] validators=[DataRequired(message='Cant be empty')]
) )
upload_or_api = StringField( upload_or_api = RadioField(
'Are you uploading a list of contacts that youre sending your message to, ' + 'How are you going to send messages?',
'or are you integrating your system with ours?', choices=[
validators=[DataRequired(message='Cant be empty')] ('File upload', 'Upload a spreadsheet of recipients'),
('API', 'Integrate with the GOV.UK Notify API'),
('API and file upload', 'Both')
],
validators=[DataRequired()]
) )
+2
View File
@@ -112,11 +112,13 @@ def service_request_to_go_live(service_id):
'subject': 'Request to go live', 'subject': 'Request to go live',
'message': ( 'message': (
'On behalf of {} ({})\n\nExpected usage\n---' 'On behalf of {} ({})\n\nExpected usage\n---'
'\nMOU in place: {}'
'\nChannel: {}\nStart date: {}\nStart volume: {}' '\nChannel: {}\nStart date: {}\nStart volume: {}'
'\nPeak volume: {}\nUpload or API: {}' '\nPeak volume: {}\nUpload or API: {}'
).format( ).format(
current_service['name'], current_service['name'],
url_for('main.service_dashboard', service_id=current_service['id'], _external=True), url_for('main.service_dashboard', service_id=current_service['id'], _external=True),
form.mou.data,
form.channel.data, form.channel.data,
form.start_date.data, form.start_date.data,
form.start_volume.data, form.start_volume.data,
@@ -1,5 +1,6 @@
{% extends "withnav_template.html" %} {% extends "withnav_template.html" %}
{% from "components/textbox.html" import textbox %} {% from "components/textbox.html" import textbox %}
{% from "components/radios.html" import radios %}
{% from "components/page-footer.html" import page_footer %} {% from "components/page-footer.html" import page_footer %}
{% from "components/banner.html" import banner_wrapper %} {% from "components/banner.html" import banner_wrapper %}
@@ -11,19 +12,10 @@
<h1 class="heading-large">Request to go live</h1> <h1 class="heading-large">Request to go live</h1>
{% call banner_wrapper(type='warning') %}
<h2 class="heading-medium">You must accept the GOV.UK&nbsp;Notify data sharing and financial agreement (Memorandum of Understanding) before we can process data for you.</h2>
<p>
<a href="{{ url_for('main.feedback') }}">Contact the Notify team</a> to get a copy of the agreement or to find out if your organisation has already accepted it.
</p>
{% endcall %}
<p> <p>
Before you request to go live, make sure youve: Before you request to go live, make sure youve:
</p> </p>
<ul class="list list-bullet"> <ul class="list list-bullet bottom-gutter">
<li>accepted our data sharing and financial agreement</li>
<li>read our <a href="{{ url_for('.terms') }}">terms of use</a></li> <li>read our <a href="{{ url_for('.terms') }}">terms of use</a></li>
<li>added <a href="{{ url_for('main.manage_users', service_id=current_service.id) }}">team members</a> to your account</li> <li>added <a href="{{ url_for('main.manage_users', service_id=current_service.id) }}">team members</a> to your account</li>
<li> <li>
@@ -39,17 +31,23 @@
</ul> </ul>
<form method="post"> <form method="post">
{{ textbox(form.channel, width='1-1') }} <div class="form-group">
{{ textbox(form.start_date, width='1-1') }} <p>We need permission to process your data before we can make your service live.</p>
{{ textbox(form.start_volume, width='1-1') }} {{ radios(form.mou) }}
{{ textbox(form.peak_volume, width='1-1') }} </div>
{{ textbox(form.upload_or_api, width='1-1') }} <div class="form-group">
{{ radios(form.channel) }}
{{ 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) }}
</div>
<p> <p>
Once youve completed the tasks needed to set up, well make your service live. Well do this within one working day. Once youve completed the tasks needed to set up, well make your service live. Well do this within one working day.
</p> </p>
<p> <p>
By requesting to go live you are agreeing to our terms of use. By requesting to go live youre agreeing to our <a href="{{ url_for('.terms') }}">terms of use</a>.
</p> </p>
{{ page_footer('Request to go live') }} {{ page_footer('Request to go live') }}
@@ -315,11 +315,12 @@ def test_should_redirect_after_request_to_go_live(
response = client.post( response = client.post(
url_for('main.service_request_to_go_live', service_id='6ce466d0-fd6a-11e5-82f5-e0accb9d11a6'), url_for('main.service_request_to_go_live', service_id='6ce466d0-fd6a-11e5-82f5-e0accb9d11a6'),
data={ data={
'channel': 'Email', 'mou': 'yes',
'channel': 'emails',
'start_date': '01/01/2017', 'start_date': '01/01/2017',
'start_volume': '100,000', 'start_volume': '100,000',
'peak_volume': '2,000,000', 'peak_volume': '2,000,000',
'upload_or_api': 'api' 'upload_or_api': 'API'
}, },
follow_redirects=True follow_redirects=True
) )
@@ -338,11 +339,11 @@ def test_should_redirect_after_request_to_go_live(
) )
returned_message = mock_post.call_args[1]['data']['message'] returned_message = mock_post.call_args[1]['data']['message']
assert 'Email' in returned_message assert 'emails' in returned_message
assert '01/01/2017' in returned_message assert '01/01/2017' in returned_message
assert '100,000' in returned_message assert '100,000' in returned_message
assert '2,000,000' in returned_message assert '2,000,000' in returned_message
assert 'api' in returned_message assert 'API' in returned_message
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser') page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
flash_banner = page.find('div', class_='banner-default').string.strip() flash_banner = page.find('div', class_='banner-default').string.strip()
@@ -377,11 +378,12 @@ def test_log_error_on_request_to_go_live(
resp = client.post( resp = client.post(
url_for('main.service_request_to_go_live', service_id='6ce466d0-fd6a-11e5-82f5-e0accb9d11a6'), url_for('main.service_request_to_go_live', service_id='6ce466d0-fd6a-11e5-82f5-e0accb9d11a6'),
data={ data={
'channel': 'channel', 'mou': 'yes',
'channel': 'emails',
'start_date': 'start_date', 'start_date': 'start_date',
'start_volume': 'start_volume', 'start_volume': 'start_volume',
'peak_volume': 'peak_volume', 'peak_volume': 'peak_volume',
'upload_or_api': 'upload_or_api' 'upload_or_api': 'API'
} }
) )
mock_logger.assert_called_with( mock_logger.assert_called_with(