Skip to content

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

Rename error msg to more readable. Confirm in tests that isValid is boolean value

Maciej Korycinski17abc379bb6d
diff --git a/saleor/graphql/account/mutations/jwt.py b/saleor/graphql/account/mutations/jwt.py
index b39d208e7f..7bf45cd686 100644
--- a/saleor/graphql/account/mutations/jwt.py
+++ b/saleor/graphql/account/mutations/jwt.py
@@ -43,7 +43,7 @@ def get_user(payload):
user = get_user_from_payload(payload)
if not user:
raise ValidationError(
- "token invalid", code=AccountErrorCode.JWT_INVALID_TOKEN.value
+ "Invalid token", code=AccountErrorCode.JWT_INVALID_TOKEN.value
)
return user
diff --git a/saleor/graphql/account/tests/mutations/test_token_verify.py b/saleor/graphql/account/tests/mutations/test_token_verify.py
index 09bf94aedc..e8ea4be256 100644
--- a/saleor/graphql/account/tests/mutations/test_token_verify.py
+++ b/saleor/graphql/account/tests/mutations/test_token_verify.py
@@ -22,7 +22,7 @@ def test_verify_token(api_client, customer_user):
response = api_client.post_graphql(MUTATION_TOKEN_VERIFY, variables)
content = get_graphql_content(response)
data = content["data"]["tokenVerify"]
- assert data["isValid"]
+ assert data["isValid"] is True
user_email = content["data"]["tokenVerify"]["user"]["email"]
assert customer_user.email == user_email
@@ -35,7 +35,7 @@ def test_verify_token_incorrect_token(api_client):
errors = data["accountErrors"]
assert len(errors) == 1
assert errors[0]["code"] == AccountErrorCode.JWT_DECODE_ERROR.name
- assert not data["isValid"]
+ assert data["isValid"] is False
assert not data["user"]