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
     }
Exemplo n.º 2
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}
Exemplo n.º 3
0
 def test_create(self, data, repo: Repository, dao: IDao):
     entity = repo.create(**data)
     assert repo.factory.deconstruct(entity) == data
     assert dao.all().count() == 0
Exemplo 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}
Exemplo n.º 5
0
 def test_create(self, data, repo: Repository, dao: IDao):
     entity = repo.create(**data)
     assert repo.schema.deconstruct(entity) == data
     assert dao.all().count() == 0
Exemplo n.º 6
0
 def test_remove_error_not_added(self, data, repo: Repository, dao: IDao):
     entity = repo.create(**data)
     with pytest.raises(InvalidQueryError):
         repo.remove(entity)