Skip to content

Commit

Permalink
Tests:alltests/test_rfc2307.py converted to test_ldap.py
Browse files Browse the repository at this point in the history
  • Loading branch information
patriki01 committed Sep 25, 2023
1 parent 233a846 commit ccc12b6
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/tests/multihost/alltests/test_rfc2307.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class Testrfc2307(object):
1. Configure SSSD to authenticate against directory server
2. Enable debug_level to 9 in the 'nss', 'pam' and domain section
"""
@pytest.mark.converted('test_ldap.py', 'test_ldap__user_with_whitespace')
@pytest.mark.tier2
def test_0001_bz1362023(self, multihost, backupsssdconf):
"""
Expand Down
44 changes: 44 additions & 0 deletions src/tests/system/tests/test_ldap.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,47 @@ def test_ldap__change_password(client: Client, ldap: LDAP, modify_mode: str):

assert client.auth.ssh.password(user, new_pass), "Authentication with new correct password failed"
assert not client.auth.ssh.password(user, old_pass), "Authentication with old incorrect password did not fail"


@pytest.mark.ticket(bz=[1067476, 1065534])
@pytest.mark.topology(KnownTopology.LDAP)
def test_ldap__user_with_whitespace(client: Client, ldap: LDAP):
"""
:title: user with a whitespace at beginning is able to login and "id"
:setup:
1. Add " space1" user with uid and password set to SSSD
2. Add user without whitespace to SSSD
3. Clear memcache, logs and db
4. Start SSSD
:steps:
1. Fetch " space1" user information using 'id'
2. Check " space1" user is able to login via ssh
3. Check "space1" user is not able to login via ssh
4. A normal user information is fetched
5. Check if a user information is not fetched if a space is added to the beginning
:expectedresults:
1. User is fetched and has correct id
2. User is able to login
3. User is not able to login
4. User is fetched and has correct id
5. User is not fetched
:customerscenario: True
"""
ldap.user(" space1").add(uid=10011, password="Secret123")
ldap.user("user1").add(uid=10012)
client.sssd.clear(db=True, memcache=True, logs=True)
client.sssd.start()

result = client.tools.id(" space1")
assert result is not None
assert result.user.id == 10011

assert client.auth.ssh.password(" space1", "Secret123")
assert not client.auth.ssh.password("space1", "Secret123")

result = client.tools.id("user1")
assert result is not None
assert result.user.id == 10012

result = client.tools.id(" user1")
assert result is None

0 comments on commit ccc12b6

Please sign in to comment.