From 11505d9bce3a375af7f22686ef2a9e3a3a70e397 Mon Sep 17 00:00:00 2001 From: Tomas Babej Date: Thu, 6 Feb 2014 16:08:04 +0100 Subject: [PATCH] ipatests: Do not require group name resolution for the non-posix tests In the non-posix tests on the legacy clients, the testuser does not belong to the testgroup (since this is represented by the NIS group membership). Relax the regular expression check for the output of the id testuser. Reviewed-By: Alexander Bokovoy --- .../test_integration/test_legacy_clients.py | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/ipatests/test_integration/test_legacy_clients.py b/ipatests/test_integration/test_legacy_clients.py index ba811c09a..d70dd1010 100644 --- a/ipatests/test_integration/test_legacy_clients.py +++ b/ipatests/test_integration/test_legacy_clients.py @@ -51,6 +51,9 @@ class BaseTestLegacyClient(object): subdomain_testuser_uid_regex = None subdomain_testuser_gid_regex = None + # To allow custom validation dependent on the trust type + posix_trust = False + @classmethod def setup_class(cls): super(BaseTestLegacyClient, cls).setup_class() @@ -152,9 +155,13 @@ class BaseTestLegacyClient(object): result = self.legacy_client.run_command(['id', testuser]) + # Only for POSIX trust testing does the testuser belong to the + # testgroup + group_name = '\(%s\)' % testgroup if self.posix_trust else '' + uid_regex = "uid=%s\(%s\)" % (self.testuser_uid_regex, testuser) - gid_regex = "gid=%s\(%s\)" % (self.testuser_gid_regex, testgroup) - groups_regex = "groups=%s\(%s\)" % (self.testuser_gid_regex, testgroup) + gid_regex = "gid=%s%s" % (self.testuser_gid_regex, group_name) + groups_regex = "groups=%s%s" % (self.testuser_gid_regex, group_name) assert re.search(uid_regex, result.stdout_text) assert re.search(gid_regex, result.stdout_text) @@ -274,9 +281,13 @@ class BaseTestLegacyClient(object): result = self.legacy_client.run_command(['id', testuser]) + # Only for POSIX trust testing does the testuser belong to the + # testgroup + group_name = '\(%s\)' % testgroup if self.posix_trust else '' + uid_regex = "uid=%s\(%s\)" % (self.testuser_uid_regex, testuser) - gid_regex = "gid=%s\(%s\)" % (self.testuser_gid_regex, testgroup) - groups_regex = "groups=%s\(%s\)" % (self.testuser_gid_regex, testgroup) + gid_regex = "gid=%s%s" % (self.testuser_gid_regex, group_name) + groups_regex = "groups=%s%s" % (self.testuser_gid_regex, group_name) assert re.search(uid_regex, result.stdout_text) assert re.search(gid_regex, result.stdout_text) @@ -395,6 +406,7 @@ class BaseTestLegacyClientPosix(BaseTestLegacyClient, subdomain_testuser_uid_regex = '10142' subdomain_testuser_gid_regex = '10147' homedir_template = "/home/{username}" + posix_trust = True def test_remove_trust_with_posix_attributes(self): pass