Skip to content

Commit 20248d2

Browse files
author
Dan Lavu
committed
tests: ldap change password tests
* ldap now edits the aci by default allowing users to change their passwords * removed su from test_ldap__password_change_no_grace_logins_left * test_ldap__shadow_policy_change_password has been parametrized in test_authentication.py, only test shadow policy now, renamed to match test_authentication
1 parent b5abb9f commit 20248d2

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

src/tests/system/tests/test_ldap.py

+6-10
Original file line numberDiff line numberDiff line change
@@ -113,16 +113,14 @@ def test_ldap__authenticate_user_with_whitespace_prefix_in_userid(client: Client
113113
@pytest.mark.ticket(bz=1507035)
114114
@pytest.mark.topology(KnownTopology.LDAP)
115115
@pytest.mark.parametrize("method", ["su", "ssh"])
116-
def test_ldap__change_password_when_ldap_pwd_policy_is_set_to_shadow(client: Client, ldap: LDAP, method: str):
116+
def test_ldap__shadow_policy_change_password(client: Client, ldap: LDAP, method: str):
117117
"""
118118
:title: Change password with shadow ldap password policy is set to shadow
119119
:description: Changing a password when the password policy is managed by the shadowAccount objectclass.
120120
:setup:
121-
1. Configure the LDAP ACI to permit user password changes
122-
2. Create user with shadowLastChange = 0, shadowMin = 0, shadowMax = 99999 and shadowWarning = 7
123-
3. Set "ldap_pwd_policy = shadow"
124-
4. Set "ldap_chpass_update_last_change = True"
125-
5. Start SSSD
121+
1. Create user with shadowLastChange = 0, shadowMin = 0, shadowMax = 99999 and shadowWarning = 7
122+
2. Set "ldap_pwd_policy = shadow" and "ldap_chpass_update_last_change = True"
123+
4. Start SSSD
126124
:steps:
127125
1. Authenticate as "tuser" with old password
128126
2. Authenticate as "tuser" with new password
@@ -131,7 +129,6 @@ def test_ldap__change_password_when_ldap_pwd_policy_is_set_to_shadow(client: Cli
131129
2. Authentication with new password was successful
132130
:customerscenario: True
133131
"""
134-
ldap.aci.add('(targetattr="userpassword")(version 3.0; acl "pwp test"; allow (all) userdn="ldap:///self";)')
135132
ldap.user("tuser").add(
136133
uid=999011, gid=999011, shadowMin=0, shadowMax=99999, shadowWarning=7, shadowLastChange=0, password="Secret123"
137134
)
@@ -342,10 +339,9 @@ def test_ldap__lookup_and_authenticate_as_user_with_different_object_search_base
342339
"modify_mode, expected, err_msg",
343340
[("exop", 1, "Expected login failure"), ("exop_force", 3, "Expected password change request")],
344341
)
345-
@pytest.mark.parametrize("method", ["su", "ssh"])
346342
@pytest.mark.topology(KnownTopology.LDAP)
347343
def test_ldap__password_change_no_grace_logins_left(
348-
client: Client, ldap: LDAP, modify_mode: str, expected: int, err_msg: str, method: str
344+
client: Client, ldap: LDAP, modify_mode: str, expected: int, err_msg: str
349345
):
350346
"""
351347
:title: Password change when no grace logins left
@@ -382,7 +378,7 @@ def test_ldap__password_change_no_grace_logins_left(
382378
client.sssd.domain["ldap_pwmodify_mode"] = modify_mode
383379
client.sssd.start()
384380

385-
rc, _, _, _ = client.auth.parametrize(method).password_with_output("user1", "Secret123")
381+
rc, _, _, _ = client.auth.ssh.password_with_output("user1", "Secret123")
386382
assert rc == expected, err_msg
387383

388384

0 commit comments

Comments
 (0)