|
|
@@ -8,7 +8,7 @@ from oscar.apps.catalogue.models import ProductClass, Product
|
|
8
|
8
|
from oscar.apps.offer.utils import Applicator
|
|
9
|
9
|
from oscar.apps.order.models import Order
|
|
10
|
10
|
from oscar.apps.order.utils import OrderCreator
|
|
11
|
|
-from oscar.apps.shipping.methods import Free, Base
|
|
|
11
|
+from oscar.apps.shipping.methods import Free, FixedPrice
|
|
12
|
12
|
from oscar.apps.shipping.repository import Repository
|
|
13
|
13
|
from oscar.core.loading import get_class
|
|
14
|
14
|
from oscar.test import factories
|
|
|
@@ -149,17 +149,6 @@ class TestPlacingOrderForDigitalGoods(TestCase):
|
|
149
|
149
|
self.assertTrue(stockrecord.num_allocated is None)
|
|
150
|
150
|
|
|
151
|
151
|
|
|
152
|
|
-class Fixed(Base):
|
|
153
|
|
- code = 'test'
|
|
154
|
|
- charge_incl_tax = charge_excl_tax = D('5.00')
|
|
155
|
|
- is_tax_known = True
|
|
156
|
|
-
|
|
157
|
|
-
|
|
158
|
|
-class StubRepository(Repository):
|
|
159
|
|
- """ Custom shipping methods """
|
|
160
|
|
- methods = (Fixed, Free)
|
|
161
|
|
-
|
|
162
|
|
-
|
|
163
|
152
|
class TestShippingOfferForOrder(TestCase):
|
|
164
|
153
|
|
|
165
|
154
|
def setUp(self):
|
|
|
@@ -179,8 +168,8 @@ class TestShippingOfferForOrder(TestCase):
|
|
179
|
168
|
add_product(self.basket, D('12.00'))
|
|
180
|
169
|
self.apply_20percent_shipping_offer()
|
|
181
|
170
|
|
|
182
|
|
- # Normal shipping 5.00
|
|
183
|
|
- shipping = StubRepository().find_by_code('test', self.basket)
|
|
|
171
|
+ shipping = FixedPrice(D('5.00'), D('5.00'))
|
|
|
172
|
+ shipping = Repository().prime_method(self.basket, shipping)
|
|
184
|
173
|
|
|
185
|
174
|
place_order(self.creator,
|
|
186
|
175
|
basket=self.basket,
|
|
|
@@ -196,8 +185,8 @@ class TestShippingOfferForOrder(TestCase):
|
|
196
|
185
|
add_product(self.basket, D('12.00'))
|
|
197
|
186
|
self.apply_20percent_shipping_offer()
|
|
198
|
187
|
|
|
199
|
|
- # Free shipping
|
|
200
|
|
- shipping = StubRepository().find_by_code(Free.code, self.basket)
|
|
|
188
|
+ shipping = Free()
|
|
|
189
|
+ shipping = Repository().prime_method(self.basket, shipping)
|
|
201
|
190
|
|
|
202
|
191
|
place_order(self.creator,
|
|
203
|
192
|
basket=self.basket,
|