当前位置: 首页>>代码示例>>Python>>正文


Python Basket.strategy方法代码示例

本文整理汇总了Python中oscar.apps.basket.models.Basket.strategy方法的典型用法代码示例。如果您正苦于以下问题:Python Basket.strategy方法的具体用法?Python Basket.strategy怎么用?Python Basket.strategy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在oscar.apps.basket.models.Basket的用法示例。


在下文中一共展示了Basket.strategy方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_line_tax_for_zero_tax_strategies

# 需要导入模块: from oscar.apps.basket.models import Basket [as 别名]
# 或者: from oscar.apps.basket.models.Basket import strategy [as 别名]
    def test_line_tax_for_zero_tax_strategies(self):
        basket = Basket()
        basket.strategy = strategy.Default()
        product = factories.create_product()
        # Tax for the default strategy will be 0
        factories.create_stockrecord(
            product, price_excl_tax=D('75.00'), num_in_stock=10)
        basket.add(product, 1)

        self.assertEqual(basket.lines.first().line_tax, D('0'))
开发者ID:django-oscar,项目名称:django-oscar,代码行数:12,代码来源:test_models.py

示例2: test_totals_for_free_products

# 需要导入模块: from oscar.apps.basket.models import Basket [as 别名]
# 或者: from oscar.apps.basket.models.Basket import strategy [as 别名]
    def test_totals_for_free_products(self):
        basket = Basket()
        basket.strategy = strategy.Default()
        # Add a zero-priced product to the basket
        product = factories.create_product()
        factories.create_stockrecord(
            product, price_excl_tax=D('0.00'), num_in_stock=10)
        basket.add(product, 1)

        self.assertEqual(basket.lines.count(), 1)
        self.assertEqual(basket.total_excl_tax, 0)
        self.assertEqual(basket.total_incl_tax, 0)
开发者ID:django-oscar,项目名称:django-oscar,代码行数:14,代码来源:test_models.py

示例3: test_line_tax_for_unknown_tax_strategies

# 需要导入模块: from oscar.apps.basket.models import Basket [as 别名]
# 或者: from oscar.apps.basket.models.Basket import strategy [as 别名]
    def test_line_tax_for_unknown_tax_strategies(self):

        class UnknownTaxStrategy(strategy.Default):
            """ A test strategy where the tax is not known """

            def pricing_policy(self, product, stockrecord):
                return prices.FixedPrice('GBP', stockrecord.price_excl_tax, tax=None)

        basket = Basket()
        basket.strategy = UnknownTaxStrategy()
        product = factories.create_product()
        factories.create_stockrecord(product, num_in_stock=10)
        basket.add(product, 1)

        self.assertEqual(basket.lines.first().line_tax, None)
开发者ID:django-oscar,项目名称:django-oscar,代码行数:17,代码来源:test_models.py

示例4: test_basket_lines_are_converted_to_xml

# 需要导入模块: from oscar.apps.basket.models import Basket [as 别名]
# 或者: from oscar.apps.basket.models.Basket import strategy [as 别名]
    def test_basket_lines_are_converted_to_xml(self):
        product = factories.create_product(price=D("12.99"))
        basket = Basket()

        # Nasty hack to make test suite work with both Oscar 0.5 and 0.6
        try:
            from oscar.apps.partner import strategy
        except ImportError:
            pass
        else:
            basket.strategy = strategy.Default()

        basket.add_product(product)
        data = the3rdman.build_data_dict(basket=basket)
        doc = the3rdman.add_fraud_fields(**data)
        xml = doc.toxml()
        self.assertXmlElementEquals(xml, "3", "The3rdMan.CustomerInformation.sales_channel")
开发者ID:WilliamRen,项目名称:django-oscar-datacash,代码行数:19,代码来源:the3rdman_tests.py


注:本文中的oscar.apps.basket.models.Basket.strategy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。