Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Remove boolean to validate service account token
Maciej Korycinski5938a2d272a0
diff --git a/saleor/graphql/account/schema.py b/saleor/graphql/account/schema.pyindex df3bbbf4cb..3e005447fb 100644--- a/saleor/graphql/account/schema.py+++ b/saleor/graphql/account/schema.py@@ -111,9 +111,6 @@ class AccountQueries(graphene.ObjectType):id=graphene.Argument(graphene.ID, required=True),description="Lookup a service account by ID.",)- service_account_valid_token = graphene.Field(- graphene.Boolean, description="Confirm token for a service account"- )user = graphene.Field(User,@@ -144,13 +141,6 @@ class AccountQueries(graphene.ObjectType):def resolve_customers(self, info, query=None, **_kwargs):return resolve_customers(info, query=query)- def resolve_service_account_valid_token(self, info):- if not hasattr(info.context, "service"):- return False- elif not info.context.service:- return False- return True-@login_requireddef resolve_me(self, info):return info.context.userdiff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphqlindex 8fd5328c0b..af91879256 100644--- a/saleor/graphql/schema.graphql+++ b/saleor/graphql/schema.graphql@@ -2435,7 +2435,7 @@ type PermissionDisplay {enum PermissionEnum {MANAGE_USERSMANAGE_STAFF- MANAGE_SERVICE_ACCOUNT+ MANAGE_SERVICE_ACCOUNTSIMPERSONATE_USERSMANAGE_DISCOUNTSMANAGE_GIFT_CARD@@ -2973,7 +2973,6 @@ type Query {staffUsers(filter: StaffUserInput, query: String, before: String, after: String, first: Int, last: Int): UserCountableConnectionserviceAccounts(filter: ServiceAccountFilterInput, before: String, after: String, first: Int, last: Int): ServiceAccountCountableConnectionserviceAccount(id: ID!): ServiceAccount- serviceAccountValidToken: Booleanuser(id: ID!): Usernode(id: ID!): Node}diff --git a/tests/api/test_account_service_account.py b/tests/api/test_account_service_account.pyindex 774291df7e..b3449a1a06 100644--- a/tests/api/test_account_service_account.py+++ b/tests/api/test_account_service_account.py@@ -4,7 +4,6 @@ import pytestfrom saleor.account.models import ServiceAccountfrom saleor.graphql.core.enums import PermissionEnum-from .conftest import ApiClientfrom .utils import assert_no_permission, get_graphql_contentSERVICE_ACCOUNT_CREATE_MUTATION = """@@ -298,38 +297,3 @@ def test_service_account_with_access_to_resources(service_account.permissions.add(permission_manage_orders)response = service_account_api_client.post_graphql(query)get_graphql_content(response)---QUERY_SERVICE_ACCOUNT_VALID_TOKEN = """- query {- serviceAccountValidToken- }- """---def test_service_account_valid_token(service_account_api_client, service_account):- response = service_account_api_client.post_graphql(- QUERY_SERVICE_ACCOUNT_VALID_TOKEN- )- content = get_graphql_content(response)- valid_token = content["data"]["serviceAccountValidToken"]- assert valid_token---def test_service_account_empty_token(service_account):- api = ApiClient()- response = api.post_graphql(QUERY_SERVICE_ACCOUNT_VALID_TOKEN)- content = get_graphql_content(response)- valid_token = content["data"]["serviceAccountValidToken"]- assert valid_token is False---def test_service_account_invalid_token(service_account_api_client, service_account):- service_account.auth_token = "12345"- service_account.save()- response = service_account_api_client.post_graphql(- QUERY_SERVICE_ACCOUNT_VALID_TOKEN- )- content = get_graphql_content(response)- valid_token = content["data"]["serviceAccountValidToken"]- assert valid_token is False