def make_tiers(carrier, prices, expires=None): for qty, handling, price in prices: t = QuantityTier(carrier=carrier, handling=Decimal("%i.00" % handling), price=Decimal("%i.00" % price), quantity=Decimal(qty), expires=expires) t.save()
def make_tiers(carrier, prices, expires=None): for qty, handling, price in prices: t = QuantityTier(carrier=carrier, handling=Decimal("%i.00" % handling), price=Decimal("%i.00" % price), quantity=Decimal(qty), expires=expires ) t.save()
def setUp(self): self.carrier = Carrier(name="pricing", active=True) self.carrier.save() t = QuantityTier(carrier=self.carrier, quantity=Decimal('1'), handling=Decimal("10.00"), price=Decimal("0.00"), ) t.save()
def setUp(self): self.carrier = Carrier(name="pricing", active=True) self.carrier.save() t = QuantityTier( carrier=self.carrier, quantity=Decimal('1'), handling=Decimal("10.00"), price=Decimal("0.00"), ) t.save()
def test2Prices(self): t = QuantityTier(carrier=self.carrier, quantity=Decimal('10'), handling=Decimal("100.00"), price=Decimal("1.00"), ) t.save() self.assertEqual(self.carrier.price(1), Decimal("10.00")) self.assertEqual(self.carrier.price(9), Decimal("10.00")) self.assertEqual(self.carrier.price(10), Decimal("110.00")) self.assertEqual(self.carrier.price(100), Decimal("200.00"))
def testCreate(self): c = Carrier(key="test", active=True) c.save() t = QuantityTier(carrier=c, quantity=Decimal('1'), handling=Decimal("10.00"), price=Decimal("0.00"), ) t.save() self.assertEqual(c.price(1), Decimal("10.00")) self.assertEqual(c.price(4), Decimal("10.00"))
def test2Prices(self): t = QuantityTier( carrier=self.carrier, quantity=Decimal('10'), handling=Decimal("100.00"), price=Decimal("1.00"), ) t.save() self.assertEqual(self.carrier.price(1), Decimal("10.00")) self.assertEqual(self.carrier.price(9), Decimal("10.00")) self.assertEqual(self.carrier.price(10), Decimal("110.00")) self.assertEqual(self.carrier.price(100), Decimal("200.00"))
def testCreate(self): c = Carrier(key="test", active=True) c.save() t = QuantityTier( carrier=c, quantity=Decimal('1'), handling=Decimal("10.00"), price=Decimal("0.00"), ) t.save() self.assertEqual(c.price(1), Decimal("10.00")) self.assertEqual(c.price(4), Decimal("10.00"))