summaryrefslogtreecommitdiffstats
path: root/ipatests/test_integration
diff options
context:
space:
mode:
authorTomas Babej <tbabej@redhat.com>2014-02-05 14:56:19 +0100
committerMartin Kosek <mkosek@redhat.com>2014-02-11 16:37:44 +0100
commit2e45002a2a320cdc797b5a475e6ef5a60a247bff (patch)
tree88a6eb2c3469cbe60da18f2fd12b09dcc83697fc /ipatests/test_integration
parentba7d404912409152f1df128d9f9b3e0148e2cc8d (diff)
downloadfreeipa-2e45002a2a320cdc797b5a475e6ef5a60a247bff.tar.gz
freeipa-2e45002a2a320cdc797b5a475e6ef5a60a247bff.tar.xz
freeipa-2e45002a2a320cdc797b5a475e6ef5a60a247bff.zip
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>
Diffstat (limited to 'ipatests/test_integration')
-rw-r--r--ipatests/test_integration/test_legacy_clients.py23
-rw-r--r--ipatests/test_integration/test_trust.py5
2 files changed, 20 insertions, 8 deletions
diff --git a/ipatests/test_integration/test_legacy_clients.py b/ipatests/test_integration/test_legacy_clients.py
index d58cdc3a6..ba811c09a 100644
--- a/ipatests/test_integration/test_legacy_clients.py
+++ b/ipatests/test_integration/test_legacy_clients.py
@@ -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
diff --git a/ipatests/test_integration/test_trust.py b/ipatests/test_integration/test_trust.py
index 68fc0285c..ec545baba 100644
--- a/ipatests/test_integration/test_trust.py
+++ b/ipatests/test_integration/test_trust.py
@@ -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)