예제 #1
0
    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})
예제 #2
0
 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"))
예제 #4
0
 def setUp(self):
     self.pclass = ProductClassFactory(name='Books', slug='books')
     super().setUp()
예제 #5
0
 def setUp(self):
     self.pclass = ProductClassFactory(name='Books', slug='books')
     self.parent = ProductFactory(structure='parent', stockrecords=[])
     super().setUp()
예제 #6
0
 def setUp(self):
     self.pclass = ProductClassFactory(name='Books', slug='books')
     super(TestCreateParentProduct, self).setUp()
예제 #7
0
 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)