def test_sale_delete(self, test_app): with test_app.app_context(): sale = SaleDB.create(**TEST_SALE) assert len(SaleDB.list_all()) == 1 deleted_sale = SaleDB.delete(sale.id) assert len(SaleDB.list_all()) == 0 assert sale is deleted_sale
def test_sale_list_all(self, test_app): with test_app.app_context(): sale1 = SaleDB.create(**TEST_SALE) sale2 = SaleDB.create( **TEST_SALE ) # This should create a new sale, not update the current one sale_list = SaleDB.list_all() assert len(sale_list) == 2 assert sale_list[0] is sale1 and sale_list[1] is sale2