mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-20 23:41:17 -05:00
[WIP] Change status code to 404 rather than 400.
This commit is contained in:
@@ -166,7 +166,7 @@ def add_user_to_service(service_id, user_id):
|
|||||||
|
|
||||||
if not user:
|
if not user:
|
||||||
return jsonify(result='error',
|
return jsonify(result='error',
|
||||||
message='User not found for id: {}'.format(user_id)), 400
|
message='User not found for id: {}'.format(user_id)), 404
|
||||||
|
|
||||||
if user in service.users:
|
if user in service.users:
|
||||||
return jsonify(result='error',
|
return jsonify(result='error',
|
||||||
|
|||||||
@@ -575,7 +575,7 @@ def test_add_existing_user_of_service_to_service_returns400(notify_api, notify_d
|
|||||||
assert result['message'] == expected_message
|
assert result['message'] == expected_message
|
||||||
|
|
||||||
|
|
||||||
def test_add_unknown_user_to_service_returns400(notify_api, notify_db, notify_db_session, sample_service):
|
def test_add_unknown_user_to_service_returns404(notify_api, notify_db, notify_db_session, sample_service):
|
||||||
with notify_api.test_request_context():
|
with notify_api.test_request_context():
|
||||||
with notify_api.test_client() as client:
|
with notify_api.test_client() as client:
|
||||||
|
|
||||||
@@ -594,7 +594,7 @@ def test_add_unknown_user_to_service_returns400(notify_api, notify_db, notify_db
|
|||||||
result = json.loads(resp.get_data(as_text=True))
|
result = json.loads(resp.get_data(as_text=True))
|
||||||
expected_message = 'User not found for id: {}'.format(incorrect_id)
|
expected_message = 'User not found for id: {}'.format(incorrect_id)
|
||||||
|
|
||||||
assert resp.status_code == 400
|
assert resp.status_code == 404
|
||||||
assert result['result'] == 'error'
|
assert result['result'] == 'error'
|
||||||
assert result['message'] == expected_message
|
assert result['message'] == expected_message
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user