mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
ipatests: Change expected home directories returned by getent
The hardcoded values for the home directories for the AD users did not properly scale up from the POSIX attrs only test scanario. When using POSIX attrs, the home dir is returned as whatever is set in the AD (/home/username by default). Without using POSIX attributes, the /home/domain/username form is taken by default. Refactor the tests to take this behaviour into account. Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
This commit is contained in:
committed by
Martin Kosek
parent
ba7d404912
commit
2e45002a2a
@@ -125,11 +125,15 @@ class BaseTestLegacyClient(object):
|
||||
testuser = 'testuser@%s' % self.ad.domain.name
|
||||
result = self.legacy_client.run_command(['getent', 'passwd', testuser])
|
||||
|
||||
testuser_regex = "testuser@%s:*:%s:%s:"\
|
||||
"Test User:/home/testuser:/bin/sh"\
|
||||
testuser_regex = "testuser@%s:\*:%s:%s:"\
|
||||
"Test User:%s:/bin/sh"\
|
||||
% (re.escape(self.ad.domain.name),
|
||||
self.testuser_uid_regex,
|
||||
self.testuser_gid_regex)
|
||||
self.testuser_gid_regex,
|
||||
self.homedir_template.format(
|
||||
username='testuser',
|
||||
domain=re.escape(self.ad.domain.name))
|
||||
)
|
||||
|
||||
assert re.search(testuser_regex, result.stdout_text)
|
||||
|
||||
@@ -236,11 +240,16 @@ class BaseTestLegacyClient(object):
|
||||
testuser = 'subdomaintestuser@%s' % self.ad_subdomain
|
||||
result = self.legacy_client.run_command(['getent', 'passwd', testuser])
|
||||
|
||||
testuser_regex = "subdomaintestuser@%s:*:%s:%s:"\
|
||||
"Subdomain Test User:/home/subdomaintestuser:/bin/sh"\
|
||||
testuser_regex = "subdomaintestuser@%s:\*:%s:%s:"\
|
||||
"Subdomain Test User:%s:"\
|
||||
"/bin/sh"\
|
||||
% (re.escape(self.ad_subdomain),
|
||||
self.subdomain_testuser_uid_regex,
|
||||
self.subdomain_testuser_gid_regex)
|
||||
self.subdomain_testuser_gid_regex,
|
||||
self.homedir_template.format(
|
||||
username='subdomaintestuser',
|
||||
domain=re.escape(self.ad_subdomain))
|
||||
)
|
||||
|
||||
assert re.search(testuser_regex, result.stdout_text)
|
||||
|
||||
@@ -385,6 +394,7 @@ class BaseTestLegacyClientPosix(BaseTestLegacyClient,
|
||||
testuser_gid_regex = '10047'
|
||||
subdomain_testuser_uid_regex = '10142'
|
||||
subdomain_testuser_gid_regex = '10147'
|
||||
homedir_template = "/home/{username}"
|
||||
|
||||
def test_remove_trust_with_posix_attributes(self):
|
||||
pass
|
||||
@@ -397,6 +407,7 @@ class BaseTestLegacyClientNonPosix(BaseTestLegacyClient,
|
||||
testuser_gid_regex = '(?!10047)(\d+)'
|
||||
subdomain_testuser_uid_regex = '(?!10142)(\d+)'
|
||||
subdomain_testuser_gid_regex = '(?!10147)(\d+)'
|
||||
homedir_template = '/home/{domain}/{username}'
|
||||
|
||||
def test_remove_nonposix_trust(self):
|
||||
pass
|
||||
|
||||
@@ -93,8 +93,9 @@ class TestBasicADTrust(ADTrustBase):
|
||||
# This regex checks that Test User does not have UID 10042 nor belongs
|
||||
# to the group with GID 10047
|
||||
testuser_regex = "^testuser@%s:\*:(?!10042)(\d+):(?!10047)(\d+):"\
|
||||
"Test User:/home/testuser:/bin/sh$"\
|
||||
% re.escape(self.ad.domain.name)
|
||||
"Test User:/home/%s/testuser:/bin/sh$"\
|
||||
% (re.escape(self.ad.domain.name),
|
||||
re.escape(self.ad.domain.name))
|
||||
|
||||
assert re.search(testuser_regex, result.stdout_text)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user