Skip to content

Commit 40fbf4b

Browse files
madhuriupadhyesumit-bose
authored andcommitted
tests: add IPA ID view test for user lookup by email
Add a system test to verify that IPA ID view overrides are correctly applied when looking up a user by email address. The test creates a user with an email, applies ID view overrides (login, uid, gid, home), and verifies that the overridden values are returned when looking up the user by: - original name - overridden name - email address Signed-off-by: Madhuri Upadhye <mupadhye@redhat.com>
1 parent ab91e33 commit 40fbf4b

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

src/tests/system/tests/test_ipa.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,55 @@ def test_ipa__idview_fails_to_apply_on_ipa_master(ipa: IPA):
598598
), "Did not get an error message when trying to apply ID view on server!"
599599

600600

601+
@pytest.mark.importance("high")
602+
@pytest.mark.topology(KnownTopology.IPA)
603+
def test_ipa__idview_lookup_user_by_email_with_overrides(client: Client, ipa: IPA):
604+
"""
605+
:title: IPA ID view overrides are applied when looking up user by email
606+
:setup:
607+
1. Create an ID view and apply the view to the client
608+
2. Create a user with an email address
609+
3. Add user override with modified login, uid, gid, and home
610+
4. Restart SSSD
611+
:steps:
612+
1. Look up the user by original name
613+
2. Look up the user by overridden name
614+
3. Look up the user by email address
615+
:expectedresults:
616+
1. User found with overridden uid, gid, and home
617+
2. User found with overridden uid, gid, and home
618+
3. User found with overridden uid, gid, and home
619+
:customerscenario: True
620+
"""
621+
ipa.idview("testview1").add(description="View for email lookup test")
622+
623+
ipa.idview("testview1").apply(hosts=[f"{client.host.hostname}"])
624+
625+
user = ipa.user("user-1").add(email="user1@ipa.test")
626+
627+
user.iduseroverride().add_override("testview1", login="o-user1", uid=999999, gid=888888, home="/home/o-user1")
628+
629+
client.sssd.restart()
630+
631+
result = client.tools.getent.passwd("user-1")
632+
assert result is not None, "User not found by original name!"
633+
assert result.uid == 999999, f"Override uid not applied for original name, got {result.uid}!"
634+
assert result.gid == 888888, f"Override gid not applied for original name, got {result.gid}!"
635+
assert result.home == "/home/o-user1", f"Override home not applied for original name, got {result.home}!"
636+
637+
result = client.tools.getent.passwd("o-user1")
638+
assert result is not None, "User not found by overridden name!"
639+
assert result.uid == 999999, f"Override uid not applied for overridden name, got {result.uid}!"
640+
assert result.gid == 888888, f"Override gid not applied for overridden name, got {result.gid}!"
641+
assert result.home == "/home/o-user1", f"Override home not applied for overridden name, got {result.home}!"
642+
643+
result = client.tools.getent.passwd("user1@ipa.test")
644+
assert result is not None, "User not found by email!"
645+
assert result.uid == 999999, f"Override uid not applied for email lookup, got {result.uid}!"
646+
assert result.gid == 888888, f"Override gid not applied for email lookup, got {result.gid}!"
647+
assert result.home == "/home/o-user1", f"Override home not applied for email lookup, got {result.home}!"
648+
649+
601650
@pytest.mark.importance("high")
602651
@pytest.mark.topology(KnownTopology.IPA)
603652
@pytest.mark.builtwith(client="virtualsmartcard")

0 commit comments

Comments
 (0)