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:
Rebecca Law
2016-03-11 12:39:55 +00:00
parent 209244ff19
commit e055590b07
19 changed files with 66 additions and 112 deletions

View File

@@ -155,4 +155,6 @@ def test_get_template_by_id_and_service(notify_db, notify_db_session, sample_ser
def test_get_template_by_id_and_service_returns_none_if_no_template(sample_service):
assert not dao_get_template_by_id_and_service_id(template_id=999, service_id=sample_service.id)
with pytest.raises(NoResultFound) as e:
dao_get_template_by_id_and_service_id(template_id=999, service_id=sample_service.id)
assert 'No row was found for one' in str(e.value)