Skip to content

Commit

Permalink
Cosmetics
Browse files Browse the repository at this point in the history
  • Loading branch information
patrys committed Oct 17, 2016
1 parent 531622b commit 2f9aa84
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .pylintrc
Expand Up @@ -2,4 +2,4 @@
load-plugins=pylint_django

[MESSAGES CONTROL]
disable = C0103, C0111, W0621
disable = C0103, C0111, I0011, W0621
4 changes: 2 additions & 2 deletions tests/conftest.py
Expand Up @@ -5,7 +5,7 @@


@pytest.fixture
def billing_address(db): # pylint: disable=I0011, W0613
def billing_address(db): # pylint: disable=W0613
return Address.objects.create(
first_name='John', last_name='Doe',
company_name='Mirumee Software',
Expand All @@ -16,7 +16,7 @@ def billing_address(db): # pylint: disable=I0011, W0613


@pytest.fixture
def product_in_stock(db): # pylint: disable=I0011, W0613
def product_in_stock(db): # pylint: disable=W0613
product = Product.objects.create(
name='Test product', price=10, weight=1)
variant = ProductVariant.objects.create(product=product, sku='123')
Expand Down
2 changes: 1 addition & 1 deletion tests/settings.py
@@ -1,4 +1,4 @@
# pylint: disable=I0011, W0401, W0614
# pylint: disable=W0401, W0614
from saleor.settings import * # noqa

SECRET_KEY = 'NOTREALLY'
Expand Down
27 changes: 11 additions & 16 deletions tests/test_cart.py
Expand Up @@ -13,7 +13,7 @@


@pytest.fixture
def cart(db): # pylint: disable=I0011, W0613
def cart(db): # pylint: disable=W0613
return Cart.objects.create()


Expand Down Expand Up @@ -242,11 +242,10 @@ def test_replace_cartline_form_when_insufficient_stock(
def test_view_empty_cart(monkeypatch, client, cart):
monkeypatch.setattr(
decorators, 'get_cart_from_request',
lambda request: cart
)
lambda request: cart)
request = client.get('/cart/')
request.discounts = None
response = views.index(request) # pylint: disable=I0011, E1120
response = views.index(request) # pylint: disable=E1120
assert response.status_code == 200


Expand All @@ -255,11 +254,10 @@ def test_view_cart(monkeypatch, client, cart, product_in_stock):
cart.add(variant, 1)
monkeypatch.setattr(
decorators, 'get_cart_from_request',
lambda request: cart
)
lambda request: cart)
request = client.get('/cart/')
request.discounts = None
response = views.index(request) # pylint: disable=I0011, E1120
response = views.index(request) # pylint: disable=E1120
assert response.status_code == 200


Expand All @@ -275,7 +273,7 @@ def test_view_update_cart_quantity(
request.discounts = None
request.POST = {'quantity': 3}
request.is_ajax = lambda: True
# pylint: disable=I0011, E1120
# pylint: disable=E1120
response = views.update(request, variant.pk)
assert response.status_code == 200
assert cart.quantity == 3
Expand All @@ -286,13 +284,12 @@ def test_view_invalid_update_cart(monkeypatch, client, cart, product_in_stock):
cart.add(variant, 1)
monkeypatch.setattr(
decorators, 'get_cart_from_request',
lambda request: cart
)
lambda request: cart)
request = client.post('/cart/update/{}'.format(variant.pk), {})
request.discounts = None
request.POST = {}
request.is_ajax = lambda: True
# pylint: disable=I0011, E1120
# pylint: disable=E1120
response = views.update(request, variant.pk)
resp_decoded = json.loads(response.content.decode('utf-8'))
assert response.status_code == 400
Expand All @@ -306,13 +303,12 @@ def test_view_invalid_add_to_cart(monkeypatch, client, cart, product_in_stock):
cart.add(variant, initial_quantity)
monkeypatch.setattr(
decorators, 'get_cart_from_request',
lambda request, create: cart
)
lambda request, create: cart)
request = client.post('/cart/add/{}'.format(variant.pk), {})
request.discounts = None
request.POST = {}
request.user = Mock(is_authenticated=lambda: False)
# pylint: disable=I0011, E1120
# pylint: disable=E1120
response = views.add_to_cart(request, variant.pk)
assert response.status_code == 302
assert cart.quantity == initial_quantity
Expand All @@ -325,12 +321,11 @@ def test_view_add_to_cart(monkeypatch, client, cart, product_in_stock):
monkeypatch.setattr(
decorators, 'get_cart_from_request',
lambda request, create: cart)

request = client.post('/cart/add/{}'.format(variant.pk), {})
request.discounts = None
request.POST = {'quantity': 1, 'variant': variant.pk}
request.user = Mock(is_authenticated=lambda: False)
# pylint: disable=I0011, E1120
# pylint: disable=E1120
response = views.add_to_cart(request, variant.pk)
assert response.status_code == 302
assert cart.quantity == initial_quantity + 1

0 comments on commit 2f9aa84

Please sign in to comment.