def make_tiers(carrier, prices, expires=None): for min_total, price in prices: t = ShippingTier(carrier=carrier, min_total=Decimal("%i.00" % min_total), price=Decimal("%i.00" % price), expires=expires) t.save()
def make_tiers(carrier, prices, expires=None): for min_total, price in prices: t = ShippingTier(carrier=carrier, min_total=Decimal("%i.00" % min_total), price=Decimal("%i.00" % price), expires=expires ) t.save()
def setUp(self): self.carrier = Carrier(name="pricing", active=True) self.carrier.save() t = ShippingTier(carrier=self.carrier, min_total=Decimal("0.00"), price=Decimal("10.00"), ) t.save()
def test2Prices(self): t = ShippingTier(carrier=self.carrier, min_total=Decimal("20.00"), price=Decimal("15.00"), ) t.save() self.assertEqual(self.carrier.price(Decimal("0.00")), Decimal("10.00")) self.assertEqual(self.carrier.price(Decimal("20.00")), Decimal("15.00"))
def testCreate(self): c = Carrier(key="test", active=True) c.save() t = ShippingTier(carrier=c, min_total=Decimal("0.00"), price=Decimal("10.00"), ) t.save() self.assertEqual(c.price(Decimal("0.00")), Decimal("10.00"))