Example #1
0
def test_view_checkout_index(monkeypatch, rf, cart_length,
                             is_shipping_required, redirect_url):
    cart = Mock(__len__=Mock(return_value=cart_length),
                is_shipping_required=Mock(return_value=is_shipping_required))
    monkeypatch.setattr('saleor.checkout.utils.get_cart_from_request',
                        lambda req, qs: cart)
    url = reverse('checkout:index')
    request = rf.get(url, follow=True)

    response = views.checkout_index(request)

    assert response.url == redirect_url
Example #2
0
def test_view_checkout_index(
        monkeypatch, rf, cart_length, is_shipping_required, redirect_url):
    cart = Mock(
        __len__=Mock(return_value=cart_length),
        is_shipping_required=Mock(return_value=is_shipping_required))
    monkeypatch.setattr(
        'saleor.checkout.utils.get_cart_from_request', lambda req, qs: cart)
    url = reverse('checkout:index')
    request = rf.get(url, follow=True)

    response = views.checkout_index(request)

    assert response.url == redirect_url