Ejemplo n.º 1
0
class ZeroFreeThresholdTest(TestCase):
    def setUp(self):
        self.method = OrderAndItemCharges(price_per_order=D("10.00"), free_shipping_threshold=D("0.00"))
        self.basket = Basket.objects.create()
        self.method.set_basket(self.basket)

    def test_free_shipping_with_empty_basket(self):
        self.assertEquals(D("0.00"), self.method.basket_charge_incl_tax())

    def test_free_shipping_with_nonempty_basket(self):
        p = create_product(D("5.00"))
        self.basket.add_product(p)
        self.assertEquals(D("0.00"), self.method.basket_charge_incl_tax())
Ejemplo n.º 2
0
class ZeroFreeThresholdTest(TestCase):
    def setUp(self):
        self.method = OrderAndItemCharges(price_per_order=D('10.00'),
                                          free_shipping_threshold=D('0.00'))
        self.basket = Basket.objects.create()
        self.method.set_basket(self.basket)

    def test_free_shipping_with_empty_basket(self):
        self.assertEquals(D('0.00'), self.method.basket_charge_incl_tax())

    def test_free_shipping_with_nonempty_basket(self):
        p = create_product(D('5.00'))
        self.basket.add_product(p)
        self.assertEquals(D('0.00'), self.method.basket_charge_incl_tax())
Ejemplo n.º 3
0
class OrderAndItemChargesTests(TestCase):
    def setUp(self):
        self.method = OrderAndItemCharges(price_per_order=D("5.00"), price_per_item=D("1.00"))
        self.basket = Basket.objects.create()
        self.method.set_basket(self.basket)

    def test_order_level_charge_for_empty_basket(self):
        self.assertEquals(D("5.00"), self.method.basket_charge_incl_tax())

    def test_single_item_basket(self):
        p = create_product()
        self.basket.add_product(p)
        self.assertEquals(D("5.00") + D("1.00"), self.method.basket_charge_incl_tax())

    def test_multi_item_basket(self):
        p = create_product()
        self.basket.add_product(p, 7)
        self.assertEquals(D("5.00") + 7 * D("1.00"), self.method.basket_charge_incl_tax())
Ejemplo n.º 4
0
class OrderAndItemChargesTests(TestCase):

    def setUp(self):
        self.method = OrderAndItemCharges(price_per_order=D('5.00'), price_per_item=D('1.00'))
        self.basket = Basket.objects.create()
        self.method.set_basket(self.basket)

    def test_order_level_charge_for_empty_basket(self):
        self.assertEquals(D('5.00'), self.method.basket_charge_incl_tax())

    def test_single_item_basket(self):
        p = create_product()
        self.basket.add_product(p)
        self.assertEquals(D('5.00') + D('1.00'), self.method.basket_charge_incl_tax())

    def test_multi_item_basket(self):
        p = create_product()
        self.basket.add_product(p, 7)
        self.assertEquals(D('5.00') + 7*D('1.00'), self.method.basket_charge_incl_tax())
Ejemplo n.º 5
0
class NonZeroFreeThresholdTest(TestCase):
    
    def setUp(self):
        self.method = OrderAndItemCharges(price_per_order=D('10.00'), free_shipping_threshold=D('20.00'))
        self.basket = Basket.objects.create()
        self.method.set_basket(self.basket)
        
    def test_basket_below_threshold(self):
        p = create_product(D('5.00'))
        self.basket.add_product(p)
        self.assertEquals(D('10.00'), self.method.basket_charge_incl_tax())
        
    def test_basket_on_threshold(self):
        p = create_product(D('5.00'))
        self.basket.add_product(p, 4)
        self.assertEquals(D('0.00'), self.method.basket_charge_incl_tax())
        
    def test_basket_above_threshold(self):
        p = create_product(D('5.00'))
        self.basket.add_product(p, 8)
        self.assertEquals(D('0.00'), self.method.basket_charge_incl_tax())
Ejemplo n.º 6
0
class NonZeroFreeThresholdTest(unittest.TestCase):
    
    def setUp(self):
        self.method = OrderAndItemCharges(price_per_order=D('10.00'), free_shipping_threshold=D('20.00'))
        self.basket = Basket.objects.create()
        self.method.set_basket(self.basket)
        
    def test_basket_below_threshold(self):
        p = create_product(D('5.00'))
        self.basket.add_product(p)
        self.assertEquals(D('10.00'), self.method.basket_charge_incl_tax())
        
    def test_basket_on_threshold(self):
        p = create_product(D('5.00'))
        self.basket.add_product(p, 4)
        self.assertEquals(D('0.00'), self.method.basket_charge_incl_tax())
        
    def test_basket_above_threshold(self):
        p = create_product(D('5.00'))
        self.basket.add_product(p, 8)
        self.assertEquals(D('0.00'), self.method.basket_charge_incl_tax())