def setUp(self): super().setUp() self.pclass = ProductClassFactory(name='T-Shirts', slug='tshirts') for attribute_type, __ in ProductAttribute.TYPE_CHOICES: values = { 'type': attribute_type, 'code': attribute_type, 'product_class': self.pclass, 'name': attribute_type, } if attribute_type == ProductAttribute.OPTION: option_group = factories.AttributeOptionGroupFactory() self.option = factories.AttributeOptionFactory( group=option_group) values['option_group'] = option_group elif attribute_type == ProductAttribute.MULTI_OPTION: option_group = factories.AttributeOptionGroupFactory() self.multi_option = factories.AttributeOptionFactory( group=option_group) values['option_group'] = option_group ProductAttributeFactory(**values) self.product = factories.ProductFactory(product_class=self.pclass) self.url = reverse('dashboard:catalogue-product', kwargs={'pk': self.product.id})
def test_redirects_to_form_page_when_valid_query_param(self): pclass = ProductClassFactory(name='Books', slug='books') url = reverse('dashboard:catalogue-product-create') response = self.get(url + '?product_class=%s' % pclass.pk) expected_url = reverse('dashboard:catalogue-product-create', kwargs={'product_class_slug': pclass.slug}) self.assertRedirects(response, expected_url)
def setUp(self): super(JournalProductUpdateSerializerTest, self).setUp() product_class = ProductClassFactory(name="Journal") self.product = ProductFactory(product_class=product_class, stockrecords=[], categories="") StockRecordFactory(partner_sku="unit02", product=self.product, partner=PartnerFactory(short_code="dummy-partner"))
def setUp(self): self.pclass = ProductClassFactory(name='Books', slug='books') super().setUp()
def setUp(self): self.pclass = ProductClassFactory(name='Books', slug='books') self.parent = ProductFactory(structure='parent', stockrecords=[]) super().setUp()
def setUp(self): self.pclass = ProductClassFactory(name='Books', slug='books') super(TestCreateParentProduct, self).setUp()
def _create_dissalowed_object_factory(self): product_class = ProductClassFactory() product = create_product(product_class=product_class) product_class.options.add(self.obj) product.product_options.add(self.obj)
def _set_up_display_delete_form_disallowed_objects(self): product_class = ProductClassFactory() product = create_product(product_class=product_class) product_class.options.add(self.option) product.product_options.add(self.option)