Example #1
0
 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)
Example #2
0
    def test_remove_all(self):
        """ Remove all the shopcart data in the system """
        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()

        # delete data
        shopcart.remove_all()
        shopcarts = Shopcart.all()
        self.assertEqual(len(shopcarts), 0)