コード例 #1
0
ファイル: test_repository.py プロジェクト: lhaze/dharma
 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}
コード例 #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}
コード例 #3
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.NOT_FOUND
     assert error_info.value.params == {
         "id": entity.__get_id__(),
         "entity": entity
     }
コード例 #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}
コード例 #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()
コード例 #6
0
ファイル: test_repository.py プロジェクト: lhaze/dharma
 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}
コード例 #7
0
ファイル: test_repository.py プロジェクト: lhaze/dharma
 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()
コード例 #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)
コード例 #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)