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'))
示例#2
0
    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=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)
示例#3
0
    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)
示例#4
0
    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, 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)
示例#5
0
    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)
    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")
示例#7
0
    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')