def setUp(self): make_category_tree() Product(name='Product 1', slug=slugify('Product 1'), active=True, unit_price=Decimal(random.randint(50, 1000)), main_category=Category.objects.get( slug='level2-first-sub')).save() Product( name='Product 2', slug=slugify('Product 2'), active=True, unit_price=Decimal(random.randint(50, 1000)), main_category=Category.objects.get(slug='level1-first')).save() Product( name='Product 3', slug=slugify('Product 3'), active=True, unit_price=Decimal(random.randint(50, 1000)), main_category=Category.objects.get(slug='level1-second')).save() Product(name='Product 4 with other treeid', slug=slugify('Product 4'), active=True, unit_price=Decimal(random.randint(50, 1000)), main_category=Category.objects.get( slug='level1-two-second')).save()
def create_fixtures(self): self.product = Product() self.product.name = 'test' self.product.short_description = 'test' self.product.long_description = 'test' self.product.unit_price = Decimal('1.0') self.product.save()
def setUp(self): self.product1 = Product() self.product1.name = 'test1' self.product1.slug = 'test1' self.product1.short_description = 'test1' self.product1.long_description = 'test1' self.product1.unit_price = Decimal('1.0') self.product1.active = True self.product1.save() self.product2 = Product() self.product2.name = 'test2' self.product2.slug = 'test2' self.product2.short_description = 'test2' self.product2.long_description = 'test2' self.product2.unit_price = Decimal('1.0') self.product2.active = False self.product2.save()
def setUp(self): self.product = Product() self.product.name = 'test' self.product.short_description = 'test' self.product.long_description = 'test' self.product.unit_price = Decimal('1.0') self.product.save() self.view = ProductDetailView(kwargs={'pk': self.product.pk})
def test_product_adds_additional_categories(self): p = Product(name='Product 5', slug=slugify('Product 5'), active=True, unit_price=Decimal(random.randint(50, 1000)), main_category=Category.objects.get(slug='level1-second')) p.save() self.assertEqual(p.additional_categories.all()[0].slug, 'level1-second')
def create_fixtures(self): self.product = Product() self.product.name = 'test' self.product.short_description = 'test' self.product.long_description = 'test' self.product.unit_price = Decimal('1.0') self.product.save() self.view = ProductDetailView(kwargs={'pk': self.product.id})
def setUp(self): cart_modifiers_pool.USE_CACHE = False user = User.objects.create(username="******", email="*****@*****.**") self.request = Mock() setattr(self.request, 'user', user) self.product = Product() self.product.name = "TestPrduct" self.product.slug = "TestPrduct" self.product.short_description = "TestPrduct" self.product.long_description = "TestPrduct" self.product.active = True self.product.unit_price = self.PRODUCT_PRICE self.product.save() self.inactive_product = Product(name='InactiveProduct', slug='InactiveProduct', active=False) self.inactive_product.save() self.cart = Cart() self.cart.user = user self.cart.save()
def setUp(self): self.category = Category() self.category.name = "test_category" self.category.save() self.product = Product() self.product.name = 'test' self.product.short_description = 'test' self.product.long_description = 'test' self.product.unit_price = Decimal('1.0') self.product.save() self.product.categories.add(self.category)
def setUp(self): self.product = Product() self.product.name = 'test' self.product.slug = 'test' self.product.unit_price = Decimal('1.0') self.product.save() self.product2 = Product() self.product2.name = 'test2' self.product2.slug = 'test2' self.product2.unit_price = Decimal('1.0') self.product2.save() self.product3 = Product() self.product3.name = 'test3' self.product3.slug = 'test3' self.product3.unit_price = Decimal('1.0') self.product3.save() self.order = Order() self.order.order_subtotal = Decimal('10') self.order.order_total = Decimal('10') self.order.shipping_cost = Decimal('0') self.order.shipping_address_text = 'shipping address example' self.order.billing_address_text = 'billing address example' self.order.save() self.orderitem1 = OrderItem() self.orderitem1.order = self.order self.orderitem1.product = self.product self.orderitem1.quantity = 5 # this will be the most bought self.orderitem1.save() self.orderitem2 = OrderItem() self.orderitem2.order = self.order self.orderitem2.product = self.product2 self.orderitem2.quantity = 1 # this will be the second most self.orderitem2.save()
def create_fixtures(options=False): product = Product(name='product 1', slug='product-1', active=True, unit_price=43) product.save() if not options: return option_group = OptionGroup(name='option group 1', slug='option-group-1') option_group.save() option_group.products.add(product) Option.objects.create(name='option 1', price='42', group=option_group) Option.objects.create(name='option 2', price='84', group=option_group)
def create_fixtures(self): cart_modifiers_pool.USE_CACHE=False self.user = User.objects.create(username="******", email="*****@*****.**", first_name="Test", last_name = "Toto") self.product = Product() self.product.name = "TestPrduct" self.product.slug = "TestPrduct" self.product.short_description = "TestPrduct" self.product.long_description = "TestPrduct" self.product.active = True self.product.unit_price = self.PRODUCT_PRICE self.product.save() self.cart = Cart() self.cart.user = self.user self.cart.save() self.client = Client() self.client.user = self.user self.client.save() self.country = Country.objects.create(name='CH') self.address = Address() self.address.client = self.client self.address.address = 'address' self.address.address2 = 'address2' self.address.zip_code = '1234' self.address.state = 'ZH' self.address.country = self.country self.address.is_billing = True self.address.is_shipping = True self.address.save() self.address2 = Address() self.address2.client = self.client self.address2.address = '2address' self.address2.address2 = '2address2' self.address2.zip_code = '21234' self.address2.state = '2ZH' self.address2.country = self.country self.address2.is_billing = True self.address2.is_shipping = False self.address2.save()
def setUp(self): cart_modifiers_pool.USE_CACHE = False self.user = User.objects.create(username="******", email="*****@*****.**") self.product = Product() self.product.name = "TestPrduct" self.product.slug = "TestPrduct" self.product.short_description = "TestPrduct" self.product.long_description = "TestPrduct" self.product.active = True self.product.unit_price = self.PRODUCT_PRICE self.product.save() self.cart = Cart() self.cart.user = self.user self.cart.save()
def create_fixtures(self): cart_modifiers_pool.USE_CACHE = False self.user = User.objects.create(username="******", email="*****@*****.**", first_name="Test", last_name="Toto") self.product = Product() self.product.name = "TestPrduct" self.product.slug = "TestPrduct" self.product.short_description = "TestPrduct" self.product.long_description = "TestPrduct" self.product.active = True self.product.unit_price = self.PRODUCT_PRICE self.product.save() self.ogroup = OptionGroup() self.ogroup.product = self.product self.ogroup.name = 'Test group' self.ogroup.save() self.option = Option() self.option.group = self.ogroup self.option.name = "Awesome" self.option.price = self.AWESOME_OPTION_PRICE self.option.save() self.cart = Cart() self.cart.user = self.user self.cart.save() self.cartitem = CartItem() self.cartitem.cart = self.cart self.cartitem.quantity = 1 self.cartitem.product = self.product self.cartitem.save()
def setUp(self): self.product = Product() self.product.name = 'test' self.product.unit_price = Decimal('1.0') self.product.save()