def test_view_get_taxed_total_with_shipping( tax_rates_countries, product_in_stock, checkout: Checkout, tax_price_factory, multiple_shipping_methods, request_checkout): variant = product_in_stock.variants.get() checkout.cart.add(variant, 1) with request_checkout: for shipping_method in multiple_shipping_methods: for country, tax_rate in tax_rates_countries.items(): checkout.shipping_method = shipping_method cart_total = float(checkout.get_total().net) expected_total = cart_total * (1 + tax_rate) resp = tax_price_factory(country) assert resp['rate'] == tax_rate assert resp['gross'] == expected_total
def test_checkout_discount(request_cart, sale, product_in_stock): variant = product_in_stock.variants.get() request_cart.add(variant, 1) checkout = Checkout(request_cart, AnonymousUser(), 'tracking_code') assert checkout.get_total() == Price(currency="USD", net=5)
def test_checkout_discount(request_cart, sale, product_in_stock): variant = product_in_stock.variants.get() request_cart.add(variant, 1) checkout = Checkout(request_cart, AnonymousUser(), 'tracking_code') assert checkout.get_total() == TaxedMoney(net=Money(5, currency="USD"), gross=Money(5, currency="USD"))
def test_checkout_discount(request_cart, sale, product_in_stock): variant = product_in_stock.variants.get() request_cart.add(variant, 1) checkout = Checkout(request_cart, AnonymousUser(), 'tracking_code') assert checkout.get_total() == TaxedMoney( net=Money(5, 'USD'), gross=Money(5, 'USD'))