From 98357858645acf93642545823af6243a72716c5a Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Tue, 23 Nov 2021 19:06:44 +0100 Subject: [PATCH] core: make test user's password optional Signed-off-by: Jens Langhammer --- authentik/core/tests/utils.py | 5 +++-- tests/e2e/test_provider_ldap.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/authentik/core/tests/utils.py b/authentik/core/tests/utils.py index bd67ee909..051667ec7 100644 --- a/authentik/core/tests/utils.py +++ b/authentik/core/tests/utils.py @@ -22,7 +22,7 @@ def create_test_flow(designation: FlowDesignation = FlowDesignation.STAGE_CONFIG ) -def create_test_admin_user(name: Optional[str] = None) -> User: +def create_test_admin_user(name: Optional[str] = None, set_password = False) -> User: """Generate a test-admin user""" uid = generate_id(20) if not name else name group = Group.objects.create(name=uid, is_superuser=True) @@ -31,7 +31,8 @@ def create_test_admin_user(name: Optional[str] = None) -> User: name=uid, email=f"{uid}@goauthentik.io", ) - user.set_password(uid) + if set_password: + user.set_password(uid) group.users.add(user) return user diff --git a/tests/e2e/test_provider_ldap.py b/tests/e2e/test_provider_ldap.py index 63c5b8b77..2206ab7f2 100644 --- a/tests/e2e/test_provider_ldap.py +++ b/tests/e2e/test_provider_ldap.py @@ -49,7 +49,7 @@ class TestProviderLDAP(SeleniumTestCase): def _prepare(self) -> User: """prepare user, provider, app and container""" # set additionalHeaders to test later - user = create_test_admin_user() + user = create_test_admin_user(set_password=True) user.attributes["extraAttribute"] = "bar" user.save()