Пример #1
0
 def test_delete(self, create_instance):
     prod_dao = ProductDao()
     new_prod = prod_dao.save(create_instance)
     result = prod_dao.read_by_id(new_prod.id)
     prod_dao.delete(result)
     result = prod_dao.read_by_id(new_prod.id)
     assert result is None
Пример #2
0
 def test_create(self, create_instance):
     product = create_instance
     prod_dao = ProductDao()
     new_prod = prod_dao.save(product)
     assert new_prod is not None
     assert new_prod.name == product.name
     assert new_prod.price == product.price
     assert new_prod.description == product.description
     prod_dao.delete(new_prod)
Пример #3
0
 def test_read_by_id(self, create_instance):
     product = create_instance
     prod_dao = ProductDao()
     new_prod = prod_dao.save(product)
     result = prod_dao.read_by_id(new_prod.id)
     assert isinstance(result, Product)
     assert new_prod.name == result.name
     assert new_prod.price == result.price
     assert new_prod.description == result.description
     prod_dao.delete(new_prod)