|
|
@@ -7,6 +7,7 @@ from oscar.apps.shipping.methods import FreeShipping, FixedPriceShipping
|
|
7
|
7
|
from oscar.apps.shipping.models import OrderAndItemLevelChargeMethod
|
|
8
|
8
|
from oscar.apps.basket.models import Basket
|
|
9
|
9
|
from oscar.test.helpers import create_product
|
|
|
10
|
+from oscar.test.decorators import dataProvider
|
|
10
|
11
|
|
|
11
|
12
|
class FreeShippingTest(unittest.TestCase):
|
|
12
|
13
|
|
|
|
@@ -17,6 +18,7 @@ class FreeShippingTest(unittest.TestCase):
|
|
17
|
18
|
self.assertEquals(D('0.00'), method.basket_charge_incl_tax())
|
|
18
|
19
|
self.assertEquals(D('0.00'), method.basket_charge_excl_tax())
|
|
19
|
20
|
|
|
|
21
|
+
|
|
20
|
22
|
class FixedPriceShippingTest(unittest.TestCase):
|
|
21
|
23
|
|
|
22
|
24
|
def test_fixed_price_shipping_charges_for_empty_basket(self):
|
|
|
@@ -32,6 +34,19 @@ class FixedPriceShippingTest(unittest.TestCase):
|
|
32
|
34
|
method.set_basket(basket)
|
|
33
|
35
|
self.assertEquals(D('10.00'), method.basket_charge_excl_tax())
|
|
34
|
36
|
|
|
|
37
|
+ shipping_values = lambda: [('1.00',),
|
|
|
38
|
+ ('5.00',),
|
|
|
39
|
+ ('10.00',),
|
|
|
40
|
+ ('12.00',)]
|
|
|
41
|
+
|
|
|
42
|
+ @dataProvider(shipping_values)
|
|
|
43
|
+ def test_different_values(self, value):
|
|
|
44
|
+ method = FixedPriceShipping(D(value))
|
|
|
45
|
+ basket = Basket()
|
|
|
46
|
+ method.set_basket(basket)
|
|
|
47
|
+ self.assertEquals(D(value), method.basket_charge_excl_tax())
|
|
|
48
|
+
|
|
|
49
|
+
|
|
35
|
50
|
class OrderAndItemLevelChargeMethodTest(unittest.TestCase):
|
|
36
|
51
|
|
|
37
|
52
|
def setUp(self):
|
|
|
@@ -52,6 +67,7 @@ class OrderAndItemLevelChargeMethodTest(unittest.TestCase):
|
|
52
|
67
|
self.basket.add_product(p, 7)
|
|
53
|
68
|
self.assertEquals(D('5.00') + 7*D('1.00'), self.method.basket_charge_incl_tax())
|
|
54
|
69
|
|
|
|
70
|
+
|
|
55
|
71
|
class ZeroFreeShippingThresholdTest(unittest.TestCase):
|
|
56
|
72
|
|
|
57
|
73
|
def setUp(self):
|
|
|
@@ -67,6 +83,7 @@ class ZeroFreeShippingThresholdTest(unittest.TestCase):
|
|
67
|
83
|
self.basket.add_product(p)
|
|
68
|
84
|
self.assertEquals(D('0.00'), self.method.basket_charge_incl_tax())
|
|
69
|
85
|
|
|
|
86
|
+
|
|
70
|
87
|
class NonZeroFreeShippingThresholdTest(unittest.TestCase):
|
|
71
|
88
|
|
|
72
|
89
|
def setUp(self):
|