|
|
@@ -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 FixedPrice, Free
|
|
|
11
|
+from oscar.apps.shipping.methods import FixedPrice, Free, Base
|
|
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
|
|
|
@@ -138,9 +138,15 @@ class TestPlacingOrderForDigitalGoods(TestCase):
|
|
138
|
138
|
self.assertTrue(stockrecord.num_allocated is None)
|
|
139
|
139
|
|
|
140
|
140
|
|
|
|
141
|
+class Fixed(Base):
|
|
|
142
|
+ code = 'test'
|
|
|
143
|
+ charge_incl_tax = charge_excl_tax = D('5.00')
|
|
|
144
|
+ is_tax_known = True
|
|
|
145
|
+
|
|
|
146
|
+
|
|
141
|
147
|
class StubRepository(Repository):
|
|
142
|
148
|
""" Custom shipping methods """
|
|
143
|
|
- methods = (FixedPrice(D('5.00'), D('5.00')), Free())
|
|
|
149
|
+ methods = (Fixed, Free)
|
|
144
|
150
|
|
|
145
|
151
|
|
|
146
|
152
|
class TestShippingOfferForOrder(TestCase):
|
|
|
@@ -152,7 +158,7 @@ class TestShippingOfferForOrder(TestCase):
|
|
152
|
158
|
def apply_20percent_shipping_offer(self):
|
|
153
|
159
|
"""Shipping offer 20% off"""
|
|
154
|
160
|
range = Range.objects.create(name="All products range",
|
|
155
|
|
- includes_all_products=True)
|
|
|
161
|
+ includes_all_products=True)
|
|
156
|
162
|
benefit = Benefit.objects.create(
|
|
157
|
163
|
range=range, type=Benefit.SHIPPING_PERCENTAGE, value=20)
|
|
158
|
164
|
offer = factories.create_offer(range=range, benefit=benefit)
|
|
|
@@ -163,7 +169,7 @@ class TestShippingOfferForOrder(TestCase):
|
|
163
|
169
|
self.apply_20percent_shipping_offer()
|
|
164
|
170
|
|
|
165
|
171
|
# Normal shipping 5.00
|
|
166
|
|
- shipping = StubRepository().find_by_code(FixedPrice.code, self.basket)
|
|
|
172
|
+ shipping = StubRepository().find_by_code('test', self.basket)
|
|
167
|
173
|
|
|
168
|
174
|
place_order(self.creator,
|
|
169
|
175
|
basket=self.basket,
|