Ejemplo n.º 1
0
    def get_price_info(self, context, quantity=1):
        """
        Get `PriceInfo` object for the product in given context.

        Returned `PriceInfo` object contains calculated `price` and
        `base_price`.  The calculation of prices is handled in the
        current pricing module.

        :type context: shoop.core.pricing.PricingContextable
        :rtype: shoop.core.pricing.PriceInfo
        """
        from shoop.core.pricing import get_price_info
        return get_price_info(product=self, context=context, quantity=quantity)
Ejemplo n.º 2
0
    def get_price_info(self, context, quantity=1):
        """
        Get `PriceInfo` object for the product in given context.

        Returned `PriceInfo` object contains calculated `price` and
        `base_price`.  The calculation of prices is handled in the
        current pricing module.

        :type context: shoop.core.pricing.PricingContextable
        :rtype: shoop.core.pricing.PriceInfo
        """
        from shoop.core.pricing import get_price_info
        return get_price_info(product=self, context=context, quantity=quantity)
Ejemplo n.º 3
0
def test_get_price_info_with_quantity(rf):
    (request, products, price) = initialize_test(rf)
    pi = get_price_info(request, products[0], 20)
    assert pi.price == price(1800)
    assert pi.base_price == price(2400)
    assert pi.quantity == 20
Ejemplo n.º 4
0
def test_get_price_info(rf):
    (request, products, price) = initialize_test(rf)
    pi = get_price_info(request, products[0])
    assert pi.price == price(90)
    assert pi.base_price == price(120)
    assert pi.quantity == 1
def test_get_price_info_with_quantity(rf):
    (request, products, price) = initialize_test(rf)
    pi = get_price_info(request, products[0], 20)
    assert pi.price == price(1800)
    assert pi.base_price == price(2400)
    assert pi.quantity == 20
def test_get_price_info(rf):
    (request, products, price) = initialize_test(rf)
    pi = get_price_info(request, products[0])
    assert pi.price == price(90)
    assert pi.base_price == price(120)
    assert pi.quantity == 1