Skip to content

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

Fix flaky test_set_password tests (#18653)

Iga Karbowiakcb00e41d9e5c
diff --git a/saleor/graphql/account/tests/mutations/authentication/test_set_password.py b/saleor/graphql/account/tests/mutations/authentication/test_set_password.py
index a0662d5f0c..48243f5dc8 100644
--- a/saleor/graphql/account/tests/mutations/authentication/test_set_password.py
+++ b/saleor/graphql/account/tests/mutations/authentication/test_set_password.py
@@ -4,6 +4,7 @@ from freezegun import freeze_time
from ......account import events as account_events
from ......account.error_codes import AccountErrorCode
+from ......account.models import User
from ......core.tokens import token_generator
from .....core.utils import str_to_enum
from .....tests.utils import get_graphql_content
@@ -32,7 +33,10 @@ SET_PASSWORD_MUTATION = """
@freeze_time("2018-05-31 12:00:01")
-def test_set_password(user_api_client, customer_user):
+def test_set_password(user_api_client):
+ customer_user = User.objects.create_user(
+ email="[email protected]", password="old-password"
+ )
token = token_generator.make_token(customer_user)
password = "spanish-inquisition"
@@ -56,11 +60,14 @@ def test_set_password(user_api_client, customer_user):
"saleor.graphql.account.mutations.authentication.set_password.match_orders_with_new_user"
)
def test_set_password_confirm_user_and_match_orders(
- match_orders_with_new_user_mock, user_api_client, customer_user
+ match_orders_with_new_user_mock, user_api_client
):
# given
- customer_user.is_confirmed = False
- customer_user.save(update_fields=["is_confirmed"])
+ customer_user = User.objects.create_user(
+ password="old-password",
+ is_confirmed=False,
+ )
token = token_generator.make_token(customer_user)
password = "spanish-inquisition"