Esempio n. 1
0
 def test_remove_error_wrong_id(self, data, repo: Repository, dao: IDao):
     id_ = dao.insert(**data)
     entity = repo.find(id_)
     repo.remove(entity)
     with pytest.raises(QueryError) as error_info:
         repo.remove(entity)
     assert error_info.value == QueryErrors.NOT_FOUND
     assert error_info.value.params == {'id': id_, 'entity': entity}
Esempio n. 2
0
 def test_remove_error_wrong_id(self, data, repo: Repository, dao: IDao):
     id_ = dao.insert(**data)
     entity = repo.find(id_)
     repo.remove(entity)
     with pytest.raises(QueryError) as error_info:
         repo.remove(entity)
     assert error_info.value == QueryErrors.NOT_FOUND
     assert error_info.value.params == {'id': id_, 'entity': entity}
 def test_remove_error_not_added(self, data, repo: Repository, dao: IDao):
     entity = repo.create(**data)
     with pytest.raises(QueryError) as error_info:
         repo.remove(entity)
     assert error_info.value == QueryErrors.NOT_FOUND
     assert error_info.value.params == {
         "id": entity.__get_id__(),
         "entity": entity
     }
Esempio n. 4
0
 def test_remove_error_not_added(self, data, repo: Repository, dao: IDao):
     entity = repo.create(**data)
     with pytest.raises(QueryError) as error_info:
         repo.remove(entity)
     assert error_info.value == QueryErrors.ENTITY_NOT_YET_ADDED
     assert error_info.value.params == {'entity': entity}
Esempio n. 5
0
 def test_remove_success(self, data, repo: Repository, dao: IDao):
     id_ = dao.insert(**data)
     entity = repo.find(id_)
     assert dao.filter_by(id_=id_).exists()
     repo.remove(entity)
     assert not dao.filter_by(id_=id_).exists()
Esempio n. 6
0
 def test_remove_error_not_added(self, data, repo: Repository, dao: IDao):
     entity = repo.create(**data)
     with pytest.raises(QueryError) as error_info:
         repo.remove(entity)
     assert error_info.value == QueryErrors.ENTITY_NOT_YET_ADDED
     assert error_info.value.params == {'entity': entity}
Esempio n. 7
0
 def test_remove_success(self, data, repo: Repository, dao: IDao):
     id_ = dao.insert(**data)
     entity = repo.find(id_)
     assert dao.filter_by(id_=id_).exists()
     repo.remove(entity)
     assert not dao.filter_by(id_=id_).exists()
Esempio n. 8
0
 def test_remove_error_wrong_id(self, data, repo: Repository, dao: IDao):
     id_ = dao.insert(**data)
     entity = repo.find(id_)
     repo.remove(entity)
     with pytest.raises(InvalidQueryError):
         repo.remove(entity)
Esempio n. 9
0
 def test_remove_error_not_added(self, data, repo: Repository, dao: IDao):
     entity = repo.create(**data)
     with pytest.raises(InvalidQueryError):
         repo.remove(entity)