Beispiel #1
0
 def test_get_discount_when_discount_applies(self):
     order = Order()
     products = ['VOUCHER', 'TSHIRT', 'VOUCHER']
     for product in products:
         order.add_product(product)
     discount = TwoForOneDiscount('VOUCHER')
     assert discount.get_discount(order) == 5.0
Beispiel #2
0
 def test_get_discount_when_discount_applies(self):
     order = Order()
     products = ['TSHIRT', 'TSHIRT', 'TSHIRT', 'VOUCHER', 'TSHIRT']
     for product in products:
         order.add_product(product)
     discount = BulkPurchaseDiscount('TSHIRT', 3, 1.00)
     assert discount.get_discount(order) == 4.0
 def test_add_product(self):
     order = Order()
     order.add_product('MUG')
     assert 'MUG' in order.product_orders
     assert order.product_orders.get('MUG').quantity == 1