def test_delete_a_product(self): """ Delete a Product """ shopcart = Shopcart(user_id=1, product_id=1, quantity=1, price=12.00) shopcart.save() self.assertEqual(len(Shopcart.all()), 1) # delete item and make sure it isn't in the database shopcart.delete() self.assertEqual(len(Shopcart.all()), 0)
def test_delete_a_shopcart_entry(self): """ Delete a shopcart entry """ shopcart = Shopcart(user_id=999, product_id=999, quantity=999, price=999.99) shopcart.save() self.assertEqual(Shopcart.findByUserId(999).count(), 1) # delete item and make sure it isn't in the database shopcart.delete() self.assertEqual(Shopcart.findByUserId(999).count(), 0)
def test_delete_user_product(self): """ Delete User Products """ shopcart = Shopcart(user_id=1, product_id=1, quantity=1, price=12.00) shopcart.save() shopcart = Shopcart(user_id=1, product_id=2, quantity=1, price=12.00) shopcart.save() shopcart = Shopcart(user_id=1, product_id=3, quantity=1, price=12.00) shopcart.save() # delete item and make sure it isn't in the database shopcart.delete() shopcarts = Shopcart.findByUserId(1) self.assertIsNot(shopcarts, None)