def test_due_joe_bulk_item_promo(self): """test to verify the return of the method due""" joe = Customer('John Doe', 0) cart = [LineItem('banana', 30, .5), LineItem('apple', 10, 1.5)] order = Order(joe, cart, BulkItemPromo()) self.assertEqual(order.due(), 28.5)
def test_due_joe_fidelity_promo(self): """test to verify the return of the method due""" joe = Customer('John Doe', 0) cart = [LineItem('banana', 4, .5), LineItem('apple', 10, 1.5)] order = Order(joe, cart, FidelityPromo()) self.assertEqual(order.due(), 17.0)
def test_due_joe_large_order_promo_with_long_order(self): """test to verify the return of the method due""" joe = Customer('John Doe', 0) cart = [LineItem(str(item_code), 1, 1.0) for item_code in range(10)] order = Order(joe, cart, LargeOrderPromo()) self.assertEqual(order.due(), 9.3)
def test_due_ana_fideliy_promo(self): """test to verify the return of the method due""" ana = Customer('Ana Smith', 1100) cart = [ LineItem('banana', 4, .5), LineItem('apple', 10, 1.5), LineItem('watermellon', 5, 5.0) ] order = Order(ana, cart, FidelityPromo()) self.assertEqual(order.due(), 39.9)
def test_due_ana_bulk_item_promo(self): """test to verify the return of the method total""" ana = Customer('Ana Smith', 1100) cart = [ LineItem('banana', 4, .5), LineItem('apple', 10, 1.5), LineItem('watermellon', 20, 5.0) ] order = Order(ana, cart, BulkItemPromo()) self.assertEqual(order.due(), 107.0)
def test_large_order_promo_with_discount(customer_fidelity_0) -> None: cart = [LineItem(str(item_code), 1, 1.0) for item_code in range(10)] order = Order(customer_fidelity_0, cart, LargeOrderPromo()) assert order.total() == 10.0 assert order.due() == 9.3
def test_large_order_promo_no_discount(customer_fidelity_0, cart_plain) -> None: order = Order(customer_fidelity_0, cart_plain, LargeOrderPromo()) assert order.total() == 42.0 assert order.due() == 42.0
def test_bulk_item_promo_with_discount(customer_fidelity_0) -> None: cart = [LineItem('banana', 30, 0.5), LineItem('apple', 10, 1.5)] order = Order(customer_fidelity_0, cart, BulkItemPromo()) assert order.total() == 30.0 assert order.due() == 28.5
def test_bulk_item_promo_no_discount(customer_fidelity_0, cart_plain) -> None: order = Order(customer_fidelity_0, cart_plain, BulkItemPromo()) assert order.total() == 42.0 assert order.due() == 42.0
def test_fidelity_promo_with_discount(customer_fidelity_1100, cart_plain) -> None: order = Order(customer_fidelity_1100, cart_plain, FidelityPromo()) assert order.total() == 42.0 assert order.due() == 39.9