Skip to content

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

Use session authentication in API tests

Marcin Gębala39c1fb1e5e41
diff --git a/tests/api/test_order.py b/tests/api/test_order.py
index 17ea4d2bc9..62254afca1 100644
--- a/tests/api/test_order.py
+++ b/tests/api/test_order.py
@@ -63,6 +63,9 @@ def test_order_query(admin_api_client, fulfilled_order):
def test_non_staff_user_can_only_see_his_order(user_api_client, order):
+ # FIXME: Remove client.login() when JWT authentication is re-enabled.
+ user_api_client.login(username=order.user.email, password='password')
+
query = """
query OrderQuery($id: ID!) {
order(id: $id) {
diff --git a/tests/conftest.py b/tests/conftest.py
index d7dee5fc40..d0e799d5e5 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -72,7 +72,10 @@ class ApiClient(Client):
@pytest.fixture
def admin_api_client(admin_user):
- return ApiClient(user=admin_user)
+ client = ApiClient(user=admin_user)
+ # FIXME: Remove client.login() when JWT authentication is re-enabled.
+ client.login(username=admin_user.email, password='password')
+ return client
@pytest.fixture
@@ -82,7 +85,10 @@ def user_api_client(customer_user):
@pytest.fixture
def staff_api_client(staff_user):
- return ApiClient(user=staff_user)
+ client = ApiClient(user=staff_user)
+ # FIXME: Remove client.login() when JWT authentication is re-enabled.
+ client.login(username=staff_user.email, password='password')
+ return client
@pytest.fixture(autouse=True)