Пример #1
0
 def test_delete_a_promotion(self):
     """ Delete a Promotion """
     promotion = Promotion("A1234", "BOGO", False, "20")
     promotion.save()
     self.assertEqual(len(Promotion.all()), 1)
     # delete the promotion and make sure it isn't in the database
     promotion.delete()
     self.assertEqual(len(Promotion.all()), 0)
Пример #2
0
 def test_delete_a_promotion(self):
     """ Delete a Promotion """
     promotion = Promotion(name="20%OFF",
                           product_id=9527,
                           discount_ratio=80)
     promotion.save()
     self.assertEqual(len(Promotion.all()), 1)
     # delete the promotion and make sure it isn't in the database
     promotion.delete()
     self.assertEqual(len(Promotion.all()), 0)
Пример #3
0
 def test_delete_a_promotion(self):
     """ Delete a promotion in the database """
     promotion = Promotion(promo_name="random",
                           goods_name="random_good",
                           category="random_category",
                           price=20,
                           discount=20,
                           available=True)
     promotion.save()
     self.assertEqual(len(Promotion.all()), 1)
     #delete the promotion
     promotion.delete()
     self.assertEqual(len(Promotion.all()), 0)
 def test_delete(self):
     promo = Promotion()
     promo.save()
     self.assertEqual(len(Promotion.all()), 1)
     promo.delete()
     self.assertEqual(len(Promotion.all()), 0)
Пример #5
0
 def test_key_error_on_delete(self, bad_mock):
     """ Test KeyError on delete """
     bad_mock.side_effect = KeyError()
     promotion = Promotion("A1234", "BOGO", True, "20")
     promotion.create()
     promotion.delete()