def test_index_view(cart, status_code, url, rf): checkout = Checkout(cart, AnonymousUser(), 'tracking_code') request = rf.get('checkout:index') request.user = checkout.user request.session = {STORAGE_SESSION_KEY: checkout.for_storage()} request.discounts = [] response = views.index_view(request, checkout, checkout.cart) assert response.status_code == status_code assert response.url == url
def test_index_view(cart, status_code, url, rf): checkout = Checkout(cart, AnonymousUser(), 'tracking_code') request = rf.get('checkout:index') request.user = checkout.user request.session = {STORAGE_SESSION_KEY: checkout.for_storage()} request.discounts = [] response = views.index_view(request, checkout, checkout.cart) assert response.status_code == status_code assert response.url == url
def test_index_view(cart, status_code, url, rf, monkeypatch): checkout = Checkout(cart, AnonymousUser(), 'tracking_code') request = rf.get('checkout:index') request.user = checkout.user request.session = {STORAGE_SESSION_KEY: checkout.for_storage()} request.discounts = [] monkeypatch.setattr( 'saleor.cart.utils.get_cart_from_request', lambda req, qs: cart) response = views.index_view(request) assert response.status_code == status_code assert response.url == url
def test_index_view(cart, status_code, url, rf, monkeypatch): checkout = Checkout(cart, AnonymousUser(), 'tracking_code') request = rf.get('checkout:index') request.user = checkout.user request.session = {STORAGE_SESSION_KEY: checkout.for_storage()} request.discounts = [] monkeypatch.setattr( 'saleor.cart.utils.get_cart_from_request', lambda req, qs: cart) response = views.index_view(request) assert response.status_code == status_code assert response.url == url
def test_index_view(checkout, cart, status_code, url, rf, monkeypatch): checkout.cart = cart request = rf.get('checkout:index', follow=True) request.user = checkout.user request.session = {STORAGE_SESSION_KEY: checkout.for_storage()} request.discounts = [] request.taxes = None monkeypatch.setattr('saleor.cart.utils.get_cart_from_request', lambda req, qs: cart) response = views.index_view(request) assert response.status_code == status_code assert response.url == url