Skip to content

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

Make empty errors returned as list

Michał Jeloneka18b1b1427f5
diff --git a/saleor/graphql/core/mutations.py b/saleor/graphql/core/mutations.py
index 8b3bd596e5..68a37f46ea 100644
--- a/saleor/graphql/core/mutations.py
+++ b/saleor/graphql/core/mutations.py
@@ -372,7 +372,7 @@ class CreateToken(ObtainJSONWebToken):
@classmethod
def resolve(cls, root, info):
- return cls(user=info.context.user)
+ return cls(user=info.context.user, errors=[])
class VerifyToken(Verify):
diff --git a/tests/api/test_account.py b/tests/api/test_account.py
index aa16dbecfd..bacabf4f18 100644
--- a/tests/api/test_account.py
+++ b/tests/api/test_account.py
@@ -36,7 +36,7 @@ def test_create_token_mutation(admin_client, staff_user):
content = get_graphql_content(response)
token_data = content['data']['tokenCreate']
assert token_data['token']
- assert not token_data['errors']
+ assert token_data['errors'] == []
incorrect_variables = {'email': staff_user.email, 'password': 'incorrect'}
response = admin_client.post(