From c9d4974267c6df6e16723686248db988d77abb8b Mon Sep 17 00:00:00 2001 From: Tomas Babej Date: Aug 07 2014 10:49:47 +0000 Subject: ipatests: test_trust: Add test to cover lookup of trusdomains Adds an integration tests that checks that all trustdomains are able to be found by trustdomain-find command right after the trust has been established. Also moves some code to allow easier adding common test cases for both POSIX and non-POSIX test classes. https://fedorahosted.org/freeipa/ticket/4208 Reviewed-By: Petr Viktorin --- diff --git a/ipatests/test_integration/test_trust.py b/ipatests/test_integration/test_trust.py index 95e48dd..597f4ce 100644 --- a/ipatests/test_integration/test_trust.py +++ b/ipatests/test_integration/test_trust.py @@ -17,6 +17,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +import nose import re from ipatests.test_integration.base import IntegrationTest @@ -29,6 +30,7 @@ class ADTrustBase(IntegrationTest): topology = 'line' num_ad_domains = 1 + optional_extra_roles = ['ad_subdomain'] @classmethod def install(cls): @@ -38,6 +40,14 @@ class ADTrustBase(IntegrationTest): cls.check_sid_generation() cls.configure_dns_and_time() + # Determine whether the subdomain AD is available + try: + child_ad = cls.host_by_role(cls.optional_extra_roles[0]) + cls.ad_subdomain = '.'.join( + child_ad.hostname.split('.')[1:]) + except LookupError: + cls.ad_subdomain = None + @classmethod def install_adtrust(cls): """Test adtrust support installation""" @@ -64,16 +74,32 @@ class ADTrustBase(IntegrationTest): tasks.configure_dns_for_trust(cls.master, cls.ad) tasks.sync_time(cls.master, cls.ad) - -class TestBasicADTrust(ADTrustBase): - """Basic Integration test for Active Directory""" - def test_establish_trust(self): """Tests establishing trust with Active Directory""" tasks.establish_trust_with_ad(self.master, self.ad, extra_args=['--range-type', 'ipa-ad-trust']) + def test_all_trustdomains_found(self): + """ + Tests that all trustdomains can be found. + """ + + if self.ad_subdomain is None: + raise nose.SkipTest('AD subdomain is not available.') + + result = self.master.run_command(['ipa', + 'trustdomain-find', + self.ad.domain.name]) + + # Check that both trustdomains appear in the result + assert self.ad.domain.name in result.stdout_text + assert self.ad_subdomain in result.stdout_text + + +class TestBasicADTrust(ADTrustBase): + """Basic Integration test for Active Directory""" + def test_range_properties_in_nonposix_trust(self): """Check the properties of the created range""" @@ -111,7 +137,7 @@ class TestBasicADTrust(ADTrustBase): class TestPosixADTrust(ADTrustBase): """Integration test for Active Directory with POSIX support""" - def test_establish_trust_with_posix_attributes(self): + def test_establish_trust(self): # Not specifying the --range-type directly, it should be detected tasks.establish_trust_with_ad(self.master, self.ad)