def setUp(self): self.original_pricing_handlers = settings.SATCHLESS_PRICING_HANDLERS settings.SATCHLESS_PRICING_HANDLERS = [ 'satchless.product.tests.pricing.FiveZlotyPriceHandler', NinetyPerecentTaxPriceHandler, TenPercentDiscountPriceHandler ] handler.init()
def setUp(self): self.macaw = DeadParrot.objects.create(slug='macaw', species="Hyacinth Macaw") self.cockatoo = DeadParrot.objects.create(slug='cockatoo', species="White Cockatoo") self.macaw_blue_a = self.macaw.variants.create(color='blue', looks_alive=True) self.macaw_blue_d = self.macaw.variants.create(color='blue', looks_alive=False) self.cockatoo_white_a = self.cockatoo.variants.create(color='white', looks_alive=True) self.cockatoo_green_a = self.cockatoo.variants.create(color='green', looks_alive=True) macaw_price = ProductPrice.objects.create(product=self.macaw, price=Decimal('10.0')) macaw_price.offsets.create(variant=self.macaw_blue_a, price_offset=Decimal('2.0')) cockatoo_price = ProductPrice.objects.create(product=self.cockatoo, price=Decimal('20.0')) cockatoo_price.offsets.create(variant=self.cockatoo_green_a, price_offset=Decimal('5.0')) # create tax groups self.vat8 = models.TaxGroup.objects.create(name="VAT 8%", rate=8, rate_name="8%") self.vat23 = models.TaxGroup.objects.create(name="VAT 23%", rate=23, rate_name="23%") self.vat8.products.add(self.macaw) # set the pricing pipeline self.original_pricing_handler = settings.SATCHLESS_PRICING_HANDLERS settings.SATCHLESS_PRICING_HANDLERS = [ 'satchless.contrib.pricing.simpleqty.handler', 'satchless.contrib.tax.flatgroups.handler', ] handler.init()
def tearDown(self): settings.SATCHLESS_PRICING_HANDLERS = self.original_pricing_handlers handler.init()