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)
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