Merge branch 'master' into add-created-by-for-jobs

This commit is contained in:
Rebecca Law
2016-04-26 16:16:51 +01:00
3 changed files with 8 additions and 3 deletions

View File

@@ -36,7 +36,7 @@ export NOTIFY_EMAIL_DOMAIN='notify.works'
export NOTIFY_JOB_QUEUE='[unique-to-environment]-notify-jobs-queue' # NOTE unique prefix
export NOTIFICATION_QUEUE_PREFIX='[unique-to-environment]-notification_development' # NOTE unique prefix
export SECRET_KEY='dev-notify-secret-key'
export SQLALCHEMY_DATABASE_URI = 'postgresql://localhost/notification_api'
export SQLALCHEMY_DATABASE_URI='postgresql://localhost/notification_api'
export TWILIO_ACCOUNT_SID=[contact team member for account sid]
export TWILIO_AUTH_TOKEN=[contact team member for auth token]
export VERIFY_CODE_FROM_EMAIL_ADDRESS='no-reply@notify.works'

View File

@@ -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

View File

@@ -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):