Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Fix tests after rebase
Pacu2b1abe1f83097
diff --git a/tests/api/test_account.py b/tests/api/test_account.pyindex a2a2a0d98d..172ba696f1 100644--- a/tests/api/test_account.py+++ b/tests/api/test_account.py@@ -1,3 +1,4 @@+import jsonimport refrom unittest.mock import Mock, patch@@ -6,6 +7,7 @@ import pytestimport graphenefrom django.contrib.auth import get_user_modelfrom django.contrib.auth.tokens import default_token_generator+from django.shortcuts import reversefrom saleor.account.models import Address, Userfrom saleor.graphql.account.mutations import (SetPassword, StaffDelete, StaffUpdate)@@ -14,7 +16,7 @@ from tests.api.utils import get_graphql_contentfrom .utils import assert_no_permission, convert_dict_keys_to_camel_case-def test_create_token_mutation(admin_api_client, staff_user):+def test_create_token_mutation(admin_client, staff_user):query = """mutation TokenCreate($email: String!, $password: String!) {tokenCreate(email: $email, password: $password) {@@ -26,21 +28,27 @@ def test_create_token_mutation(admin_api_client, staff_user):}}"""- variables = {'email': staff_user.email, 'password': 'password'}- response = admin_api_client.post_graphql(query, variables)+ variables = json.dumps({'email': staff_user.email, 'password': 'password'})+ response = admin_client.post(+ reverse('api'), json.dumps({'query': query, 'variables': variables}),+ content_type='application/json')content = get_graphql_content(response)token_data = content['data']['tokenCreate']assert token_data['token']assert not token_data['errors']- incorrect_variables = {'email': staff_user.email, 'password': 'wat'}- response = admin_api_client.post_graphql(query, incorrect_variables)+ incorrect_variables = json.dumps(+ {'email': staff_user.email, 'password': 'incorrect'})+ response = admin_client.post(+ reverse('api'),+ json.dumps({'query': query, 'variables': incorrect_variables}),+ content_type='application/json')content = get_graphql_content(response)token_data = content['data']['tokenCreate']- assert not token_data['token']errors = token_data['errors']assert errorsassert not errors[0]['field']+ assert not token_data['token']def test_token_create_user_data(diff --git a/tests/api/test_attributes.py b/tests/api/test_attributes.pyindex 08232dbc63..0feb63fa39 100644--- a/tests/api/test_attributes.py+++ b/tests/api/test_attributes.py@@ -373,6 +373,7 @@ def test_update_attribute_value(admin_api_client, pink_attribute_value):response = admin_api_client.post_graphql(query, variables)content = get_graphql_content(response)data = content['data']['attributeValueUpdate']+ value.refresh_from_db()assert data['attributeValue']['name'] == name == value.nameassert data['attributeValue']['slug'] == slugify(name)assert name in [value['name'] for value in data['attribute']['values']]@@ -400,7 +401,7 @@ def test_update_same_attribute_value(id = graphene.Node.to_global_id('AttributeValue', value.id)attr_value = '#BLUE'variables = {'name': value.name, 'value': attr_value, 'id': id}- response = admin_api_client.post(query, variables)+ response = admin_api_client.post_graphql(query, variables)content = get_graphql_content(response)data = content['data']['attributeValueUpdate']assert not data['errors']