mirror of
https://github.com/GSA/notifications-api.git
synced 2026-09-11 18:38:14 -04: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:
@@ -11,7 +11,7 @@ from app.dao.services_dao import (
|
||||
)
|
||||
from app.dao.users_dao import save_model_user
|
||||
from app.models import Service, User
|
||||
from sqlalchemy.orm.exc import FlushError
|
||||
from sqlalchemy.orm.exc import FlushError, NoResultFound
|
||||
from sqlalchemy.exc import IntegrityError
|
||||
|
||||
|
||||
@@ -145,7 +145,9 @@ def test_get_all_user_services_should_return_empty_list_if_no_services_for_user(
|
||||
|
||||
|
||||
def test_get_service_by_id_returns_none_if_no_service(notify_db):
|
||||
assert not dao_fetch_service_by_id(str(uuid.uuid4()))
|
||||
with pytest.raises(NoResultFound) as e:
|
||||
dao_fetch_service_by_id(str(uuid.uuid4()))
|
||||
assert 'No row was found for one()' in str(e)
|
||||
|
||||
|
||||
def test_get_service_by_id_returns_service(service_factory):
|
||||
|
||||
Reference in New Issue
Block a user