Skip to content

Saleor Core: the high performance, composable, headless commerce API.

use User model instead django_user_model fixture

Maciek Jabłoński66d900ff04bc
diff --git a/tests/conftest.py b/tests/conftest.py
index 9822881a41..818c6fa566 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -7,7 +7,7 @@ from saleor.cart import decorators
from saleor.cart.models import Cart
from saleor.product.models import Product, ProductVariant, Stock
from saleor.shipping.models import ShippingMethod
-from saleor.userprofile.models import Address
+from saleor.userprofile.models import Address, User
@pytest.fixture
@@ -32,20 +32,15 @@ def request_cart(cart, monkeypatch):
@pytest.fixture
-def normal_user(django_user_model):
- return django_user_model.objects.create_user('[email protected]',
- 'password', is_active=True)
+def normal_user(db):
+ return User.objects.create_user('[email protected]', 'password')
@pytest.fixture()
-def admin_user(django_user_model):
+def admin_user(db):
"""A Django admin user.
-
- This uses an existing user with username "admin", or creates a new one with
- password "password".
"""
- return django_user_model.objects.create_superuser('[email protected]',
- 'password', is_active=True)
+ return User.objects.create_superuser('[email protected]', 'password')
@pytest.fixture()
@@ -75,7 +70,7 @@ def billing_address(db): # pylint: disable=W0613
@pytest.fixture
-def shipping_method():
+def shipping_method(db):
shipping_method = ShippingMethod.objects.create(name='DHL')
shipping_method.price_per_country.create(price=10)
return shipping_method
diff --git a/tests/test_checkout_integration.py b/tests/test_checkout_integration.py
index 7e86027dde..d81db61a0b 100644
--- a/tests/test_checkout_integration.py
+++ b/tests/test_checkout_integration.py
@@ -190,7 +190,7 @@ def test_summary_without_shipping_method(cart_with_item, client, monkeypatch):
assert get_redirect_location(response) == reverse('checkout:shipping-method')
-def test_client_login(cart_with_item, client, admin_user): # pylint: disable=W0613
+def test_client_login(cart_with_item, client, admin_user):
data = {
'username': admin_user.email,
'password': 'password'