Example #1
0
def test_waiver():
    sm = ShippingMethod(
        name="Waivey",
        tax_class=get_default_tax_class(),
        module_data={"price_waiver_product_minimum": "370", "price": "100"},
    )
    source = BasketishOrderSource()
    assert not source.prices_include_tax()
    assert sm.get_effective_name(source) == u"Waivey"
    assert sm.get_effective_price(source) == TaxlessPrice(100)
    source.lines = [
        SourceLine(type=OrderLineType.PRODUCT, product=get_default_product(), unit_price=TaxlessPrice(400), quantity=1)
    ]
    assert sm.get_effective_price(source) == TaxlessPrice(0)
Example #2
0
def test_waiver():
    sm = ShippingMethod(name="Waivey", tax_class=get_default_tax_class(),
                        module_data={
                            "price_waiver_product_minimum": "370",
                            "price": "100"
                        })
    source = BasketishOrderSource(get_default_shop())
    assert sm.get_effective_name(source) == u"Waivey"
    assert sm.get_effective_price_info(source).price == source.shop.create_price(100)
    source.add_line(
        type=OrderLineType.PRODUCT,
        product=get_default_product(),
        base_unit_price=source.shop.create_price(400),
        quantity=1
    )
    assert sm.get_effective_price_info(source).price == source.shop.create_price(0)
Example #3
0
def test_waiver():
    sm = ShippingMethod(name="Waivey",
                        tax_class=get_default_tax_class(),
                        module_data={
                            "price_waiver_product_minimum": "370",
                            "price": "100"
                        })
    source = BasketishOrderSource(get_default_shop())
    assert sm.get_effective_name(source) == u"Waivey"
    assert sm.get_effective_price_info(
        source).price == source.shop.create_price(100)
    source.add_line(type=OrderLineType.PRODUCT,
                    product=get_default_product(),
                    base_unit_price=source.shop.create_price(400),
                    quantity=1)
    assert sm.get_effective_price_info(
        source).price == source.shop.create_price(0)
Example #4
0
def test_waiver():
    sm = ShippingMethod(name="Waivey",
                        tax_class=get_default_tax_class(),
                        module_data={
                            "price_waiver_product_minimum": "370",
                            "price": "100"
                        })
    source = BasketishOrderSource()
    assert not source.prices_include_tax()
    assert sm.get_effective_name(source) == u"Waivey"
    assert sm.get_effective_price(source) == TaxlessPrice(100)
    source.lines = [
        SourceLine(type=OrderLineType.PRODUCT,
                   product=get_default_product(),
                   unit_price=TaxlessPrice(400),
                   quantity=1)
    ]
    assert sm.get_effective_price(source) == TaxlessPrice(0)