core: make test user's password optional
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
d785998c5a
commit
9835785864
|
@ -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,6 +31,7 @@ def create_test_admin_user(name: Optional[str] = None) -> User:
|
|||
name=uid,
|
||||
email=f"{uid}@goauthentik.io",
|
||||
)
|
||||
if set_password:
|
||||
user.set_password(uid)
|
||||
group.users.add(user)
|
||||
return user
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
Reference in New Issue