Exemplo n.º 1
0
def test_get_cart_data_no_shipping(request_cart_with_item, vatlayer):
    cart = request_cart_with_item
    shipment_option = get_shipping_price_estimate(
        cart.get_subtotal().gross, cart.get_total_weight(), 'PL', vatlayer)
    cart_data = utils.get_cart_data(
        cart, shipment_option, 'USD', None, vatlayer)
    cart_total = cart_data['cart_total']
    assert cart_total == TaxedMoney(
        net=Money('8.13', 'USD'), gross=Money(10, 'USD'))
    assert cart_data['total_with_shipping'].start == cart_total
Exemplo n.º 2
0
def test_get_checkout_data(request_checkout_with_item, shipping_zone, vatlayer):
    checkout = request_checkout_with_item
    shipment_option = get_shipping_price_estimate(
        checkout.get_subtotal().gross, checkout.get_total_weight(), 'PL', vatlayer)
    checkout_data = utils.get_checkout_context(
        checkout, None, vatlayer, currency='USD', shipping_range=shipment_option)
    assert checkout_data['checkout_total'] == TaxedMoney(
        net=Money('8.13', 'USD'), gross=Money(10, 'USD'))
    assert checkout_data['total_with_shipping'].start == TaxedMoney(
        net=Money('16.26', 'USD'), gross=Money(20, 'USD'))
Exemplo n.º 3
0
def test_get_checkout_context_no_shipping(request_checkout_with_item, vatlayer):
    checkout = request_checkout_with_item
    shipment_option = get_shipping_price_estimate(
        checkout.get_subtotal().gross, checkout.get_total_weight(), "PL", vatlayer
    )
    checkout_data = utils.get_checkout_context(
        checkout, None, vatlayer, currency="USD", shipping_range=shipment_option
    )
    checkout_total = checkout_data["checkout_total"]
    assert checkout_total == TaxedMoney(
        net=Money("8.13", "USD"), gross=Money(10, "USD")
    )
    assert checkout_data["total_with_shipping"].start == checkout_total
Exemplo n.º 4
0
def test_get_checkout_context_no_shipping(request_checkout_with_item, vatlayer):
    checkout = request_checkout_with_item
    shipment_option = get_shipping_price_estimate(
        checkout.get_subtotal().gross, checkout.get_total_weight(), "PL", vatlayer
    )
    checkout_data = utils.get_checkout_context(
        checkout, None, vatlayer, currency="USD", shipping_range=shipment_option
    )
    checkout_total = checkout_data["checkout_total"]
    assert checkout_total == TaxedMoney(
        net=Money("8.13", "USD"), gross=Money(10, "USD")
    )
    assert checkout_data["total_with_shipping"].start == checkout_total
Exemplo n.º 5
0
def test_get_checkout_context_no_shipping(checkout_with_single_item):
    shipment_option = get_shipping_price_estimate(
        checkout_with_single_item.get_subtotal(),
        checkout_with_single_item.get_total_weight(),
        "PL",
    )
    checkout_data = utils.get_checkout_context(checkout_with_single_item,
                                               None,
                                               currency="USD",
                                               shipping_range=shipment_option)
    checkout_total = checkout_data["checkout_total"]
    assert checkout_total == TaxedMoney(net=Money("10.00", "USD"),
                                        gross=Money("10.00", "USD"))
    assert checkout_data["total_with_shipping"].start == checkout_total