本文整理汇总了Python中oscar.apps.shipping.models.OrderAndItemCharges.basket_charge_incl_tax方法的典型用法代码示例。如果您正苦于以下问题:Python OrderAndItemCharges.basket_charge_incl_tax方法的具体用法?Python OrderAndItemCharges.basket_charge_incl_tax怎么用?Python OrderAndItemCharges.basket_charge_incl_tax使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oscar.apps.shipping.models.OrderAndItemCharges
的用法示例。
在下文中一共展示了OrderAndItemCharges.basket_charge_incl_tax方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ZeroFreeThresholdTest
# 需要导入模块: from oscar.apps.shipping.models import OrderAndItemCharges [as 别名]
# 或者: from oscar.apps.shipping.models.OrderAndItemCharges import basket_charge_incl_tax [as 别名]
class ZeroFreeThresholdTest(TestCase):
def setUp(self):
self.method = OrderAndItemCharges(price_per_order=D("10.00"), free_shipping_threshold=D("0.00"))
self.basket = Basket.objects.create()
self.method.set_basket(self.basket)
def test_free_shipping_with_empty_basket(self):
self.assertEquals(D("0.00"), self.method.basket_charge_incl_tax())
def test_free_shipping_with_nonempty_basket(self):
p = create_product(D("5.00"))
self.basket.add_product(p)
self.assertEquals(D("0.00"), self.method.basket_charge_incl_tax())
示例2: OrderAndItemChargesTests
# 需要导入模块: from oscar.apps.shipping.models import OrderAndItemCharges [as 别名]
# 或者: from oscar.apps.shipping.models.OrderAndItemCharges import basket_charge_incl_tax [as 别名]
class OrderAndItemChargesTests(TestCase):
def setUp(self):
self.method = OrderAndItemCharges(price_per_order=D("5.00"), price_per_item=D("1.00"))
self.basket = Basket.objects.create()
self.method.set_basket(self.basket)
def test_order_level_charge_for_empty_basket(self):
self.assertEquals(D("5.00"), self.method.basket_charge_incl_tax())
def test_single_item_basket(self):
p = create_product()
self.basket.add_product(p)
self.assertEquals(D("5.00") + D("1.00"), self.method.basket_charge_incl_tax())
def test_multi_item_basket(self):
p = create_product()
self.basket.add_product(p, 7)
self.assertEquals(D("5.00") + 7 * D("1.00"), self.method.basket_charge_incl_tax())
示例3: NonZeroFreeThresholdTest
# 需要导入模块: from oscar.apps.shipping.models import OrderAndItemCharges [as 别名]
# 或者: from oscar.apps.shipping.models.OrderAndItemCharges import basket_charge_incl_tax [as 别名]
class NonZeroFreeThresholdTest(TestCase):
def setUp(self):
self.method = OrderAndItemCharges(price_per_order=D('10.00'), free_shipping_threshold=D('20.00'))
self.basket = Basket.objects.create()
self.method.set_basket(self.basket)
def test_basket_below_threshold(self):
p = create_product(D('5.00'))
self.basket.add_product(p)
self.assertEquals(D('10.00'), self.method.basket_charge_incl_tax())
def test_basket_on_threshold(self):
p = create_product(D('5.00'))
self.basket.add_product(p, 4)
self.assertEquals(D('0.00'), self.method.basket_charge_incl_tax())
def test_basket_above_threshold(self):
p = create_product(D('5.00'))
self.basket.add_product(p, 8)
self.assertEquals(D('0.00'), self.method.basket_charge_incl_tax())