mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 09:51:11 -05:00
Changed db queries to use one, which throws NoResultFound exception, this exception is dealt with in our error handlers.
Now a lot of the if none checks can be removed.
This commit is contained in:
@@ -130,7 +130,7 @@ def test_get_service_by_id_should_404_if_no_service(notify_api, notify_db):
|
||||
assert resp.status_code == 404
|
||||
json_resp = json.loads(resp.get_data(as_text=True))
|
||||
assert json_resp['result'] == 'error'
|
||||
assert json_resp['message'] == 'Service not found for service id: {} '.format(service_id)
|
||||
assert json_resp['message'] == 'No result found'
|
||||
|
||||
|
||||
def test_get_service_by_id_and_user(notify_api, service_factory, sample_user):
|
||||
@@ -467,7 +467,7 @@ def test_get_users_for_service_returns_404_when_service_does_not_exist(notify_ap
|
||||
assert response.status_code == 404
|
||||
result = json.loads(response.get_data(as_text=True))
|
||||
assert result['result'] == 'error'
|
||||
assert result['message'] == 'Service not found for id: {}'.format(service_id)
|
||||
assert result['message'] == 'No result found'
|
||||
|
||||
|
||||
def test_default_permissions_are_added_for_user_service(notify_api,
|
||||
@@ -779,7 +779,7 @@ def test_add_existing_user_to_non_existing_service_returns404(notify_api,
|
||||
)
|
||||
|
||||
result = json.loads(resp.get_data(as_text=True))
|
||||
expected_message = 'Service not found for id: {}'.format(incorrect_id)
|
||||
expected_message = 'No result found'
|
||||
|
||||
assert resp.status_code == 404
|
||||
assert result['result'] == 'error'
|
||||
@@ -833,7 +833,7 @@ def test_add_unknown_user_to_service_returns404(notify_api, notify_db, notify_db
|
||||
)
|
||||
|
||||
result = json.loads(resp.get_data(as_text=True))
|
||||
expected_message = 'User not found for id: {}'.format(incorrect_id)
|
||||
expected_message = 'No result found'
|
||||
|
||||
assert resp.status_code == 404
|
||||
assert result['result'] == 'error'
|
||||
|
||||
Reference in New Issue
Block a user