|
|
@@ -1,455 +1,21 @@
|
|
1
|
|
-# coding=utf-8
|
|
2
|
|
-"""
|
|
3
|
|
-Factories using factory boy.
|
|
4
|
|
-
|
|
5
|
|
-Using a silly module name as I don't want to mix the old and new
|
|
6
|
|
-implementations of factories, but I do want to allow importing both from the
|
|
7
|
|
-same place.
|
|
8
|
|
-
|
|
9
|
|
-In 2020, when all tests use the new factory-boy factories, we can rename this
|
|
10
|
|
-module to factories.py and drop the old ones.
|
|
11
|
|
-"""
|
|
12
|
|
-import datetime
|
|
13
|
|
-from decimal import Decimal as D
|
|
14
|
|
-from decimal import ROUND_HALF_UP
|
|
15
|
|
-
|
|
16
|
|
-import factory
|
|
17
|
|
-from django.conf import settings
|
|
18
|
|
-from django.contrib.auth import models as auth_models
|
|
19
|
|
-from django.utils.timezone import now
|
|
20
|
|
-
|
|
21
|
|
-from oscar.core.loading import get_model, get_class
|
|
22
|
|
-from oscar.core.compat import get_user_model
|
|
23
|
|
-from oscar.core.phonenumber import PhoneNumber
|
|
24
|
|
-from oscar.core.utils import slugify
|
|
25
|
|
-
|
|
26
|
|
-__all__ = ["UserFactory", "CountryFactory", "UserAddressFactory",
|
|
27
|
|
- "BasketFactory", "VoucherFactory", "ProductFactory",
|
|
28
|
|
- "ProductClassFactory", "StockRecordFactory",
|
|
29
|
|
- "ProductAttributeFactory", "ProductAttributeValueFactory",
|
|
30
|
|
- "AttributeOptionGroupFactory",
|
|
31
|
|
- "AttributeOptionFactory", "PartnerFactory",
|
|
32
|
|
- "ProductCategoryFactory", "CategoryFactory", "RangeFactory",
|
|
33
|
|
- "OptionFactory", "BasketLineAttributeFactory",
|
|
34
|
|
- "PermissionFactory", "ShippingAddressFactory",
|
|
35
|
|
- "ProductReviewFactory", "SourceTypeFactory"]
|
|
36
|
|
-
|
|
37
|
|
-Selector = get_class('partner.strategy', 'Selector')
|
|
38
|
|
-
|
|
39
|
|
-
|
|
40
|
|
-class UserFactory(factory.DjangoModelFactory):
|
|
41
|
|
- username = factory.Sequence(lambda n: 'the_j_meister nummer %d' % n)
|
|
42
|
|
- email = factory.Sequence(lambda n: 'example_%s@example.com' % n)
|
|
43
|
|
- first_name = 'joseph'
|
|
44
|
|
- last_name = 'winterbottom'
|
|
45
|
|
- password = factory.PostGenerationMethodCall('set_password', 'skelebrain')
|
|
46
|
|
- is_active = True
|
|
47
|
|
- is_superuser = False
|
|
48
|
|
- is_staff = False
|
|
49
|
|
-
|
|
50
|
|
- class Meta:
|
|
51
|
|
- model = get_user_model()
|
|
52
|
|
-
|
|
53
|
|
-
|
|
54
|
|
-class CountryFactory(factory.DjangoModelFactory):
|
|
55
|
|
- iso_3166_1_a2 = 'GB'
|
|
56
|
|
- name = "UNITED KINGDOM"
|
|
57
|
|
-
|
|
58
|
|
- class Meta:
|
|
59
|
|
- model = get_model('address', 'Country')
|
|
60
|
|
- django_get_or_create = ('iso_3166_1_a2',)
|
|
61
|
|
-
|
|
62
|
|
-
|
|
63
|
|
-class UserAddressFactory(factory.DjangoModelFactory):
|
|
64
|
|
- title = "Dr"
|
|
65
|
|
- first_name = "Barry"
|
|
66
|
|
- last_name = 'Barrington'
|
|
67
|
|
- line1 = "1 King Road"
|
|
68
|
|
- line4 = "London"
|
|
69
|
|
- postcode = "SW1 9RE"
|
|
70
|
|
- phone_number = PhoneNumber.from_string('+49 351 3296645')
|
|
71
|
|
- country = factory.SubFactory(CountryFactory)
|
|
72
|
|
- user = factory.SubFactory(UserFactory)
|
|
73
|
|
-
|
|
74
|
|
- class Meta:
|
|
75
|
|
- model = get_model('address', 'UserAddress')
|
|
76
|
|
-
|
|
77
|
|
-
|
|
78
|
|
-class BasketFactory(factory.DjangoModelFactory):
|
|
79
|
|
- @factory.post_generation
|
|
80
|
|
- def set_strategy(self, create, extracted, **kwargs):
|
|
81
|
|
- # Load default strategy (without a user/request)
|
|
82
|
|
- self.strategy = Selector().strategy()
|
|
83
|
|
-
|
|
84
|
|
- class Meta:
|
|
85
|
|
- model = get_model('basket', 'Basket')
|
|
86
|
|
-
|
|
87
|
|
-
|
|
88
|
|
-class OptionFactory(factory.DjangoModelFactory):
|
|
89
|
|
- class Meta:
|
|
90
|
|
- model = get_model('catalogue', 'Option')
|
|
91
|
|
-
|
|
92
|
|
- name = 'example option'
|
|
93
|
|
- code = 'example'
|
|
94
|
|
- type = Meta.model.OPTIONAL
|
|
95
|
|
-
|
|
96
|
|
-
|
|
97
|
|
-class BasketLineAttributeFactory(factory.DjangoModelFactory):
|
|
98
|
|
- option = factory.SubFactory(OptionFactory)
|
|
99
|
|
-
|
|
100
|
|
- class Meta:
|
|
101
|
|
- model = get_model('basket', 'LineAttribute')
|
|
102
|
|
-
|
|
103
|
|
-
|
|
104
|
|
-class VoucherFactory(factory.DjangoModelFactory):
|
|
105
|
|
- name = "My voucher"
|
|
106
|
|
- code = "MYVOUCHER"
|
|
107
|
|
-
|
|
108
|
|
- start_datetime = now() - datetime.timedelta(days=1)
|
|
109
|
|
- end_datetime = now() + datetime.timedelta(days=10)
|
|
110
|
|
-
|
|
111
|
|
- class Meta:
|
|
112
|
|
- model = get_model('voucher', 'Voucher')
|
|
113
|
|
-
|
|
114
|
|
-
|
|
115
|
|
-class PartnerFactory(factory.DjangoModelFactory):
|
|
116
|
|
- name = "Gardners"
|
|
117
|
|
-
|
|
118
|
|
- class Meta:
|
|
119
|
|
- model = get_model('partner', 'Partner')
|
|
120
|
|
-
|
|
121
|
|
- @factory.post_generation
|
|
122
|
|
- def users(self, create, extracted, **kwargs):
|
|
123
|
|
- if not create:
|
|
124
|
|
- return
|
|
125
|
|
-
|
|
126
|
|
- if extracted:
|
|
127
|
|
- for user in extracted:
|
|
128
|
|
- self.users.add(user)
|
|
129
|
|
-
|
|
130
|
|
-
|
|
131
|
|
-class StockRecordFactory(factory.DjangoModelFactory):
|
|
132
|
|
- partner = factory.SubFactory(PartnerFactory)
|
|
133
|
|
- partner_sku = factory.Sequence(lambda n: 'unit%d' % n)
|
|
134
|
|
- price_currency = "GBP"
|
|
135
|
|
- price_excl_tax = D('9.99')
|
|
136
|
|
- num_in_stock = 100
|
|
137
|
|
-
|
|
138
|
|
- class Meta:
|
|
139
|
|
- model = get_model('partner', 'StockRecord')
|
|
140
|
|
-
|
|
141
|
|
-
|
|
142
|
|
-class ProductClassFactory(factory.DjangoModelFactory):
|
|
143
|
|
- name = "Books"
|
|
144
|
|
- requires_shipping = True
|
|
145
|
|
- track_stock = True
|
|
146
|
|
-
|
|
147
|
|
- class Meta:
|
|
148
|
|
- model = get_model('catalogue', 'ProductClass')
|
|
149
|
|
-
|
|
150
|
|
-
|
|
151
|
|
-class CategoryFactory(factory.DjangoModelFactory):
|
|
152
|
|
- name = factory.Sequence(lambda n: 'Category %d' % n)
|
|
153
|
|
-
|
|
154
|
|
- # Very naive handling of treebeard node fields. Works though!
|
|
155
|
|
- depth = 1
|
|
156
|
|
- path = factory.Sequence(lambda n: '%04d' % n)
|
|
157
|
|
-
|
|
158
|
|
- class Meta:
|
|
159
|
|
- model = get_model('catalogue', 'Category')
|
|
160
|
|
-
|
|
161
|
|
-
|
|
162
|
|
-class ProductCategoryFactory(factory.DjangoModelFactory):
|
|
163
|
|
- category = factory.SubFactory(CategoryFactory)
|
|
164
|
|
-
|
|
165
|
|
- class Meta:
|
|
166
|
|
- model = get_model('catalogue', 'ProductCategory')
|
|
167
|
|
-
|
|
168
|
|
-
|
|
169
|
|
-class ProductFactory(factory.DjangoModelFactory):
|
|
170
|
|
- class Meta:
|
|
171
|
|
- model = get_model('catalogue', 'Product')
|
|
172
|
|
-
|
|
173
|
|
- structure = Meta.model.STANDALONE
|
|
174
|
|
- upc = factory.Sequence(lambda n: '978080213020%d' % n)
|
|
175
|
|
- title = "A confederacy of dunces"
|
|
176
|
|
- product_class = factory.SubFactory(ProductClassFactory)
|
|
177
|
|
-
|
|
178
|
|
- stockrecords = factory.RelatedFactory(StockRecordFactory, 'product')
|
|
179
|
|
- categories = factory.RelatedFactory(ProductCategoryFactory, 'product')
|
|
180
|
|
-
|
|
181
|
|
-
|
|
182
|
|
-class ProductAttributeFactory(factory.DjangoModelFactory):
|
|
183
|
|
- code = name = 'weight'
|
|
184
|
|
- product_class = factory.SubFactory(ProductClassFactory)
|
|
185
|
|
- type = "float"
|
|
186
|
|
-
|
|
187
|
|
- class Meta:
|
|
188
|
|
- model = get_model('catalogue', 'ProductAttribute')
|
|
189
|
|
-
|
|
190
|
|
-
|
|
191
|
|
-class AttributeOptionGroupFactory(factory.DjangoModelFactory):
|
|
192
|
|
- name = u'Grüppchen'
|
|
193
|
|
-
|
|
194
|
|
- class Meta:
|
|
195
|
|
- model = get_model('catalogue', 'AttributeOptionGroup')
|
|
196
|
|
-
|
|
197
|
|
-
|
|
198
|
|
-class AttributeOptionFactory(factory.DjangoModelFactory):
|
|
199
|
|
- # Ideally we'd get_or_create a AttributeOptionGroup here, but I'm not
|
|
200
|
|
- # aware of how to not create a unique option group for each call of the
|
|
201
|
|
- # factory
|
|
202
|
|
-
|
|
203
|
|
- option = factory.Sequence(lambda n: 'Option %d' % n)
|
|
204
|
|
-
|
|
205
|
|
- class Meta:
|
|
206
|
|
- model = get_model('catalogue', 'AttributeOption')
|
|
207
|
|
-
|
|
208
|
|
-
|
|
209
|
|
-class ProductAttributeValueFactory(factory.DjangoModelFactory):
|
|
210
|
|
- attribute = factory.SubFactory(ProductAttributeFactory)
|
|
211
|
|
- product = factory.SubFactory(ProductFactory)
|
|
212
|
|
-
|
|
213
|
|
- class Meta:
|
|
214
|
|
- model = get_model('catalogue', 'ProductAttributeValue')
|
|
215
|
|
-
|
|
216
|
|
-
|
|
217
|
|
-class ProductReviewFactory(factory.DjangoModelFactory):
|
|
218
|
|
- score = 5
|
|
219
|
|
- product = factory.SubFactory(ProductFactory, stockrecords=[])
|
|
220
|
|
-
|
|
221
|
|
- class Meta:
|
|
222
|
|
- model = get_model('reviews', 'ProductReview')
|
|
223
|
|
-
|
|
224
|
|
-
|
|
225
|
|
-class RangeFactory(factory.DjangoModelFactory):
|
|
226
|
|
- name = factory.Sequence(lambda n: 'Range %d' % n)
|
|
227
|
|
- slug = factory.Sequence(lambda n: 'range-%d' % n)
|
|
228
|
|
-
|
|
229
|
|
- class Meta:
|
|
230
|
|
- model = get_model('offer', 'Range')
|
|
231
|
|
-
|
|
232
|
|
- @factory.post_generation
|
|
233
|
|
- def products(self, create, extracted, **kwargs):
|
|
234
|
|
- if not create or not extracted:
|
|
235
|
|
- return
|
|
236
|
|
-
|
|
237
|
|
- RangeProduct = get_model('offer', 'RangeProduct')
|
|
238
|
|
-
|
|
239
|
|
- for product in extracted:
|
|
240
|
|
- RangeProduct.objects.create(product=product, range=self)
|
|
241
|
|
-
|
|
242
|
|
-
|
|
243
|
|
-class ShippingAddressFactory(factory.DjangoModelFactory):
|
|
244
|
|
- first_name = 'John'
|
|
245
|
|
- last_name = 'Doe'
|
|
246
|
|
- line1 = 'Streetname'
|
|
247
|
|
- line2 = '1a'
|
|
248
|
|
- line4 = 'City'
|
|
249
|
|
- postcode = '1000 AA'
|
|
250
|
|
- phone_number = '06-12345678'
|
|
251
|
|
- country = factory.SubFactory(CountryFactory)
|
|
252
|
|
-
|
|
253
|
|
- class Meta:
|
|
254
|
|
- model = get_model('order', 'ShippingAddress')
|
|
255
|
|
-
|
|
256
|
|
-
|
|
257
|
|
-class BillingAddressFactory(factory.DjangoModelFactory):
|
|
258
|
|
- country = factory.SubFactory(CountryFactory)
|
|
259
|
|
-
|
|
260
|
|
- first_name = 'John'
|
|
261
|
|
- last_name = 'Doe'
|
|
262
|
|
- line1 = 'Streetname'
|
|
263
|
|
- line2 = '1a'
|
|
264
|
|
- line4 = 'City'
|
|
265
|
|
- postcode = '1000AA'
|
|
266
|
|
-
|
|
267
|
|
- class Meta:
|
|
268
|
|
- model = get_model('order', 'BillingAddress')
|
|
269
|
|
-
|
|
270
|
|
-
|
|
271
|
|
-class OrderFactory(factory.DjangoModelFactory):
|
|
272
|
|
- class Meta:
|
|
273
|
|
- model = get_model('order', 'Order')
|
|
274
|
|
- exclude = ('basket',)
|
|
275
|
|
-
|
|
276
|
|
- if hasattr(settings, 'OSCAR_INITIAL_ORDER_STATUS'):
|
|
277
|
|
- status = settings.OSCAR_INITIAL_ORDER_STATUS
|
|
278
|
|
-
|
|
279
|
|
- site_id = settings.SITE_ID
|
|
280
|
|
- number = factory.LazyAttribute(lambda o: '%d' % (100000 + o.basket.pk))
|
|
281
|
|
- basket = factory.SubFactory(BasketFactory)
|
|
282
|
|
-
|
|
283
|
|
- shipping_code = 'delivery'
|
|
284
|
|
- shipping_incl_tax = D('4.95')
|
|
285
|
|
- shipping_excl_tax = factory.LazyAttribute(
|
|
286
|
|
- lambda o: tax_subtract(o.shipping_incl_tax))
|
|
287
|
|
-
|
|
288
|
|
- total_incl_tax = factory.LazyAttribute(lambda o: o.basket.total_incl_tax)
|
|
289
|
|
- total_excl_tax = factory.LazyAttribute(lambda o: o.basket.total_excl_tax)
|
|
290
|
|
-
|
|
291
|
|
- guest_email = factory.LazyAttribute(
|
|
292
|
|
- lambda o: (
|
|
293
|
|
- '%s.%s@example.com' % (
|
|
294
|
|
- o.billing_address.first_name[0],
|
|
295
|
|
- o.billing_address.last_name
|
|
296
|
|
- )).lower())
|
|
297
|
|
-
|
|
298
|
|
- shipping_address = factory.SubFactory(ShippingAddressFactory)
|
|
299
|
|
- billing_address = factory.SubFactory(BillingAddressFactory)
|
|
300
|
|
-
|
|
301
|
|
- @classmethod
|
|
302
|
|
- def _create(cls, target_class, *args, **kwargs):
|
|
303
|
|
- date_placed = kwargs.pop('date_placed', None)
|
|
304
|
|
- instance = super(OrderFactory, cls)._create(
|
|
305
|
|
- target_class, *args, **kwargs)
|
|
306
|
|
-
|
|
307
|
|
- if date_placed:
|
|
308
|
|
- instance.date_placed = date_placed
|
|
309
|
|
- return instance
|
|
310
|
|
-
|
|
311
|
|
-
|
|
312
|
|
-class OrderLineFactory(factory.DjangoModelFactory):
|
|
313
|
|
- order = factory.SubFactory(OrderFactory)
|
|
314
|
|
- product = factory.SubFactory(ProductFactory)
|
|
315
|
|
- partner_sku = factory.LazyAttribute(lambda l: l.product.upc)
|
|
316
|
|
- stockrecord = factory.LazyAttribute(
|
|
317
|
|
- lambda l: l.product.stockrecords.first())
|
|
318
|
|
- quantity = 1
|
|
319
|
|
-
|
|
320
|
|
- line_price_incl_tax = factory.LazyAttribute(
|
|
321
|
|
- lambda obj: tax_add(obj.stockrecord.price_excl_tax) * obj.quantity)
|
|
322
|
|
- line_price_excl_tax = factory.LazyAttribute(
|
|
323
|
|
- lambda obj: obj.stockrecord.price_excl_tax * obj.quantity)
|
|
324
|
|
-
|
|
325
|
|
- line_price_before_discounts_incl_tax = (
|
|
326
|
|
- factory.SelfAttribute('.line_price_incl_tax'))
|
|
327
|
|
- line_price_before_discounts_excl_tax = (
|
|
328
|
|
- factory.SelfAttribute('.line_price_excl_tax'))
|
|
329
|
|
-
|
|
330
|
|
- unit_price_incl_tax = factory.LazyAttribute(
|
|
331
|
|
- lambda obj: tax_add(obj.stockrecord.price_excl_tax))
|
|
332
|
|
- unit_cost_price = factory.LazyAttribute(
|
|
333
|
|
- lambda obj: obj.stockrecord.cost_price)
|
|
334
|
|
- unit_price_excl_tax = factory.LazyAttribute(
|
|
335
|
|
- lambda obj: obj.stockrecord.price_excl_tax)
|
|
336
|
|
- unit_retail_price = factory.LazyAttribute(
|
|
337
|
|
- lambda obj: obj.stockrecord.price_retail)
|
|
338
|
|
-
|
|
339
|
|
- class Meta:
|
|
340
|
|
- model = get_model('order', 'Line')
|
|
341
|
|
-
|
|
342
|
|
-
|
|
343
|
|
-class ShippingEventTypeFactory(factory.DjangoModelFactory):
|
|
344
|
|
- name = 'Test event'
|
|
345
|
|
- code = factory.LazyAttribute(lambda o: slugify(o.name).replace('-', '_'))
|
|
346
|
|
-
|
|
347
|
|
- class Meta:
|
|
348
|
|
- model = get_model('order', 'ShippingEventType')
|
|
349
|
|
- django_get_or_create = ('code', )
|
|
350
|
|
-
|
|
351
|
|
-
|
|
352
|
|
-class ShippingEventFactory(factory.DjangoModelFactory):
|
|
353
|
|
-
|
|
354
|
|
- order = factory.SubFactory(OrderFactory)
|
|
355
|
|
- event_type = factory.SubFactory(ShippingEventTypeFactory)
|
|
356
|
|
-
|
|
357
|
|
- class Meta:
|
|
358
|
|
- model = get_model('order', 'ShippingEvent')
|
|
359
|
|
-
|
|
360
|
|
-
|
|
361
|
|
-def tax_subtract(price, tax_percentage=21):
|
|
362
|
|
- """Subtract the given `tax_percentage` from the given `price`."""
|
|
363
|
|
- if price is None:
|
|
364
|
|
- return None
|
|
365
|
|
-
|
|
366
|
|
- result = price / ((100 + tax_percentage) / D(100))
|
|
367
|
|
- return result.quantize(D('0.01'), ROUND_HALF_UP)
|
|
368
|
|
-
|
|
369
|
|
-
|
|
370
|
|
-def tax_add(price, tax_percentage=21):
|
|
371
|
|
- """Add the given `tax_percentage` to the given `price`."""
|
|
372
|
|
- if price is None:
|
|
373
|
|
- return None
|
|
374
|
|
-
|
|
375
|
|
- result = price * ((100 + tax_percentage) / D(100))
|
|
376
|
|
- return result.quantize(D('0.01'), ROUND_HALF_UP)
|
|
377
|
|
-
|
|
378
|
|
-
|
|
379
|
|
-class PermissionFactory(factory.DjangoModelFactory):
|
|
380
|
|
- name = 'Dummy permission'
|
|
381
|
|
- codename = 'dummy'
|
|
382
|
|
-
|
|
383
|
|
- class Meta:
|
|
384
|
|
- model = auth_models.Permission
|
|
385
|
|
- django_get_or_create = ('content_type', 'codename')
|
|
386
|
|
-
|
|
387
|
|
-
|
|
388
|
|
-class SourceTypeFactory(factory.DjangoModelFactory):
|
|
389
|
|
- name = 'Creditcard'
|
|
390
|
|
- code = 'creditcard'
|
|
391
|
|
-
|
|
392
|
|
- class Meta:
|
|
393
|
|
- model = get_model('payment', 'SourceType')
|
|
394
|
|
-
|
|
395
|
|
-
|
|
396
|
|
-class SourceFactory(factory.DjangoModelFactory):
|
|
397
|
|
- order = factory.SubFactory(OrderFactory)
|
|
398
|
|
- source_type = factory.SubFactory(SourceTypeFactory)
|
|
399
|
|
-
|
|
400
|
|
- class Meta:
|
|
401
|
|
- model = get_model('payment', 'Source')
|
|
402
|
|
-
|
|
403
|
|
-
|
|
404
|
|
-class TransactionFactory(factory.DjangoModelFactory):
|
|
405
|
|
- amount = factory.LazyAttribute(lambda obj: obj.source.order.total_incl_tax)
|
|
406
|
|
- reference = factory.LazyAttribute(lambda obj: obj.source.order.number)
|
|
407
|
|
- source = factory.SubFactory(SourceFactory)
|
|
408
|
|
- status = 'authorised'
|
|
409
|
|
-
|
|
410
|
|
- class Meta:
|
|
411
|
|
- model = get_model('payment', 'Transaction')
|
|
412
|
|
-
|
|
413
|
|
- @classmethod
|
|
414
|
|
- def _create(cls, target_class, *args, **kwargs):
|
|
415
|
|
- date_created = kwargs.pop('date_created', None)
|
|
416
|
|
- instance = super(TransactionFactory, cls)._create(
|
|
417
|
|
- target_class, *args, **kwargs)
|
|
418
|
|
-
|
|
419
|
|
- if date_created:
|
|
420
|
|
- instance.date_created = date_created
|
|
421
|
|
- instance.save()
|
|
422
|
|
- return instance
|
|
423
|
|
-
|
|
424
|
|
-
|
|
425
|
|
-class ConditionFactory(factory.DjangoModelFactory):
|
|
426
|
|
- type = get_model('offer', 'Condition').COUNT
|
|
427
|
|
- value = 10
|
|
428
|
|
-
|
|
429
|
|
- class Meta:
|
|
430
|
|
- model = get_model('offer', 'Condition')
|
|
431
|
|
-
|
|
432
|
|
-
|
|
433
|
|
-class BenefitFactory(factory.DjangoModelFactory):
|
|
434
|
|
- type = get_model('offer', 'Benefit').PERCENTAGE
|
|
435
|
|
- value = 10
|
|
436
|
|
- max_affected_items = None
|
|
437
|
|
- range = factory.SubFactory(RangeFactory)
|
|
438
|
|
-
|
|
439
|
|
- class Meta:
|
|
440
|
|
- model = get_model('offer', 'Benefit')
|
|
441
|
|
-
|
|
442
|
|
-
|
|
443
|
|
-class ConditionalOfferFactory(factory.DjangoModelFactory):
|
|
444
|
|
- name = 'Test offer'
|
|
445
|
|
- benefit = factory.SubFactory(BenefitFactory)
|
|
446
|
|
- condition = factory.SubFactory(ConditionFactory)
|
|
447
|
|
-
|
|
448
|
|
- class Meta:
|
|
449
|
|
- model = get_model('offer','ConditionalOffer')
|
|
450
|
|
-
|
|
451
|
|
-
|
|
452
|
|
-class OrderDiscountFactory(factory.DjangoModelFactory):
|
|
453
|
|
-
|
|
454
|
|
- class Meta:
|
|
455
|
|
- model = get_model('order', 'OrderDiscount')
|
|
|
1
|
+import warnings
|
|
|
2
|
+
|
|
|
3
|
+from oscar.test.factories.address import * # noqa
|
|
|
4
|
+from oscar.test.factories.basket import * # noqa
|
|
|
5
|
+from oscar.test.factories.catalogue import * # noqa
|
|
|
6
|
+from oscar.test.factories.contrib import * # noqa
|
|
|
7
|
+from oscar.test.factories.customer import * # noqa
|
|
|
8
|
+from oscar.test.factories.offer import * # noqa
|
|
|
9
|
+from oscar.test.factories.order import * # noqa
|
|
|
10
|
+from oscar.test.factories.partner import * # noqa
|
|
|
11
|
+from oscar.test.factories.payment import * # noqa
|
|
|
12
|
+from oscar.test.factories.utils import * # noqa
|
|
|
13
|
+from oscar.test.factories.voucher import * # noqa
|
|
|
14
|
+
|
|
|
15
|
+
|
|
|
16
|
+message = (
|
|
|
17
|
+ "Module '%s' is deprecated and will be removed in the next major version "
|
|
|
18
|
+ "of django-oscar"
|
|
|
19
|
+) % __name__
|
|
|
20
|
+
|
|
|
21
|
+warnings.warn(message, PendingDeprecationWarning)
|