mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-04 10:21:14 -05:00
Merge pull request #265 from alphagov/fix-duplicate-service-name-test
Fix test for duplicate service name
This commit is contained in:
@@ -64,6 +64,8 @@ def register_errors(blueprint):
|
||||
'duplicate key value violates unique constraint "services_email_from_key"' in e.orig.pgerror):
|
||||
return jsonify(
|
||||
result='error',
|
||||
message={'name': ["Duplicate service name '{}'".format(e.params.get('name', ''))]}
|
||||
message={'name': ["Duplicate service name '{}'".format(
|
||||
e.params.get('name', e.params.get('email_from', ''))
|
||||
)]}
|
||||
), 400
|
||||
return jsonify(result='error', message="Internal server error"), 500
|
||||
|
||||
@@ -494,7 +494,10 @@ def test_should_not_update_service_with_duplicate_email_from(notify_api,
|
||||
assert resp.status_code == 400
|
||||
json_resp = json.loads(resp.get_data(as_text=True))
|
||||
assert json_resp['result'] == 'error'
|
||||
assert "Duplicate service name '{}'".format(service_name) in json_resp['message']['name']
|
||||
assert (
|
||||
"Duplicate service name '{}'".format(service_name) in json_resp['message']['name'] or
|
||||
"Duplicate service name '{}'".format(email_from) in json_resp['message']['name']
|
||||
)
|
||||
|
||||
|
||||
def test_update_service_should_404_if_id_is_invalid(notify_api, notify_db, notify_db_session):
|
||||
|
||||
Reference in New Issue
Block a user