mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-07 09:38:25 -04:00
Updates:
* Fix tests * Add tests for new message format
This commit is contained in:
@@ -347,25 +347,25 @@ class Feedback(Form):
|
|||||||
|
|
||||||
class RequestToGoLiveForm(Form):
|
class RequestToGoLiveForm(Form):
|
||||||
channel = StringField(
|
channel = StringField(
|
||||||
'Are you sending emails or text messages or both?'
|
'Are you sending emails or text messages or both?',
|
||||||
, validators=[DataRequired(message='Can’t be empty')]
|
validators=[DataRequired(message='Can’t be empty')]
|
||||||
)
|
)
|
||||||
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='Can’t be empty')]
|
validators=[DataRequired(message='Can’t 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 per month to start with? Give an estimate in numbers.',
|
||||||
, validators=[DataRequired(message='Can’t be empty')]
|
validators=[DataRequired(message='Can’t 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 a month increase and when will that start? Give an estimate.',
|
||||||
, validators=[DataRequired(message='Can’t be empty')]
|
validators=[DataRequired(message='Can’t be empty')]
|
||||||
)
|
)
|
||||||
upload_or_api = StringField(
|
upload_or_api = StringField(
|
||||||
'Are you uploading a list of contacts that you’re sending your message to, ' +
|
'Are you uploading a list of contacts that you’re sending your message to, ' +
|
||||||
'or are you integrating your system with ours?'
|
'or are you integrating your system with ours?',
|
||||||
, validators=[DataRequired(message='Can’t be empty')]
|
validators=[DataRequired(message='Can’t be empty')]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -313,7 +313,13 @@ def test_should_redirect_after_request_to_go_live(
|
|||||||
client.login(api_user_active)
|
client.login(api_user_active)
|
||||||
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={'usage': "One million messages"},
|
data={
|
||||||
|
'channel': 'Email',
|
||||||
|
'start_date': '01/01/2017',
|
||||||
|
'start_volume': '100,000',
|
||||||
|
'peak_volume': '2,000,000',
|
||||||
|
'upload_or_api': 'api'
|
||||||
|
},
|
||||||
follow_redirects=True
|
follow_redirects=True
|
||||||
)
|
)
|
||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
@@ -323,13 +329,20 @@ def test_should_redirect_after_request_to_go_live(
|
|||||||
'subject': 'Request to go live',
|
'subject': 'Request to go live',
|
||||||
'department_id': ANY,
|
'department_id': ANY,
|
||||||
'agent_team_id': ANY,
|
'agent_team_id': ANY,
|
||||||
'message': ANY, # noqa
|
'message': ANY,
|
||||||
'person_name': api_user_active.name,
|
'person_name': api_user_active.name,
|
||||||
'person_email': api_user_active.email_address
|
'person_email': api_user_active.email_address
|
||||||
},
|
},
|
||||||
headers=ANY
|
headers=ANY
|
||||||
)
|
)
|
||||||
|
|
||||||
|
returned_message = mock_post.call_args[1]['data']['message']
|
||||||
|
assert 'Email' in returned_message
|
||||||
|
assert '01/01/2017' in returned_message
|
||||||
|
assert '100,000' in returned_message
|
||||||
|
assert '2,000,000' 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()
|
||||||
h1 = page.find('h1').string.strip()
|
h1 = page.find('h1').string.strip()
|
||||||
@@ -362,7 +375,13 @@ def test_log_error_on_request_to_go_live(
|
|||||||
with pytest.raises(InternalServerError):
|
with pytest.raises(InternalServerError):
|
||||||
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={'usage': 'blah'}
|
data={
|
||||||
|
'channel': 'channel',
|
||||||
|
'start_date': 'start_date',
|
||||||
|
'start_volume': 'start_volume',
|
||||||
|
'peak_volume': 'peak_volume',
|
||||||
|
'upload_or_api': 'upload_or_api'
|
||||||
|
}
|
||||||
)
|
)
|
||||||
mock_logger.assert_called_with(
|
mock_logger.assert_called_with(
|
||||||
"Deskpro create ticket request failed with {} '{}'".format(mock_post().status_code, mock_post().json())
|
"Deskpro create ticket request failed with {} '{}'".format(mock_post().status_code, mock_post().json())
|
||||||
|
|||||||
Reference in New Issue
Block a user