From e73d1e3dc3ea8af3cbdad04fd9379805e27a98f0 Mon Sep 17 00:00:00 2001 From: Omer Cohen <639682+omercnet@users.noreply.github.com> Date: Tue, 12 Dec 2023 18:12:53 +0200 Subject: [PATCH] randomize login_id --- example_app/test_admin.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/example_app/test_admin.py b/example_app/test_admin.py index 13e9721..6bf46ab 100644 --- a/example_app/test_admin.py +++ b/example_app/test_admin.py @@ -1,5 +1,7 @@ import json import logging +import random +import string import descope from descope import REFRESH_SESSION_TOKEN_NAME, SESSION_TOKEN_NAME @@ -11,11 +13,15 @@ logger = logging.getLogger(__name__) +def random_string(N: int) -> str: + return "".join(random.choices(string.ascii_uppercase + string.digits, k=N)) + + class AdminLoginTestCase(TestCase): def test_test_user_can_login_to_admin(self): """Test that if user has the right roles they can login to admin""" - login_id = "test@test.internal" + login_id = f"test+{random_string(8)}@test.internal" delivery_method = descope.DeliveryMethod.EMAIL descope_client.mgmt.user.create_test_user( login_id, role_names=["is_staff", "is_superuser"], verified_email=True