Skip to content

Commit

Permalink
randomize login_id
Browse files Browse the repository at this point in the history
  • Loading branch information
omercnet committed Dec 12, 2023
1 parent 66c467e commit e73d1e3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion example_app/test_admin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import json
import logging
import random
import string

import descope
from descope import REFRESH_SESSION_TOKEN_NAME, SESSION_TOKEN_NAME
Expand All @@ -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 = "[email protected]"
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
Expand Down

0 comments on commit e73d1e3

Please sign in to comment.