multiple category in ProductFactory
This commit is contained in:
@@ -9,9 +9,18 @@ from companies.factories import CompanyFactory
|
||||
from products.models import Product
|
||||
|
||||
|
||||
FAKE_CATEGORIES = (
|
||||
('categoria-1'),
|
||||
('categoria-2'),
|
||||
('categoria-3'),
|
||||
('categoria-4'),
|
||||
('categoria-5'),
|
||||
('categoria-6'),
|
||||
)
|
||||
|
||||
class ProductFactory(DjangoModelFactory):
|
||||
|
||||
|
||||
company = SubFactory(CompanyFactory)
|
||||
sku = FuzzyText(prefix='SKU_', length=10)
|
||||
name = FuzzyText(prefix='NAME_', length=10)
|
||||
@@ -26,7 +35,7 @@ class ProductFactory(DjangoModelFactory):
|
||||
discount = FuzzyDecimal(low=0.00, high=100.00)
|
||||
stock = FuzzyInteger(low=0)
|
||||
tags = ['test']
|
||||
category = 'top-category' # main tag category
|
||||
category = FuzzyChoice(choices=FAKE_CATEGORIES) # main tag category
|
||||
attributes = ['programming/python', 'testing']
|
||||
identifiers = FuzzyText(prefix='IDENTIFIERS_', length=100)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user