URL: https://github.com/freeipa/freeipa/pull/77
Author: mirielka
 Title: #77: Tests: Update host test with ipa-join
Action: synchronized

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/77/head:pr77
git checkout pr77
From a31c9b19918eac94a03277b35ff6e9c3b9319edc Mon Sep 17 00:00:00 2001
From: Lenka Doudova <ldoud...@redhat.com>
Date: Tue, 20 Sep 2016 09:12:48 +0200
Subject: [PATCH 1/2] Tests: Update host test with ipa-join

Updating path to ipa-join command to allow execution of
test_xmlrpc/test_host::TestHostFalsePwdChange::test_join_host.

https://fedorahosted.org/freeipa/ticket/6326
---
 ipatests/test_xmlrpc/test_host_plugin.py | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/ipatests/test_xmlrpc/test_host_plugin.py b/ipatests/test_xmlrpc/test_host_plugin.py
index 4ddabef..7e1dad0 100644
--- a/ipatests/test_xmlrpc/test_host_plugin.py
+++ b/ipatests/test_xmlrpc/test_host_plugin.py
@@ -42,6 +42,7 @@
 from ipatests.test_xmlrpc.tracker.host_plugin import HostTracker
 from ipatests.test_xmlrpc.testcert import get_testcert
 from ipatests.util import assert_deepequal
+from ipaplatform.paths import paths
 
 # Constants DNS integration tests
 # TODO: Use tracker fixtures for zones/records/users/groups
@@ -520,14 +521,18 @@ class TestHostFalsePwdChange(XMLRPC_test):
     def test_join_host(self, host, keytabname):
         """
         Create a test host and join it into IPA.
+
+        This test must not run remotely.
         """
 
-        join_command = 'ipa-client/ipa-join'
-        if not os.path.isfile(join_command):
-            pytest.skip("Command '%s' not found" % join_command)
+        if not os.path.isfile(paths.SBIN_IPA_JOIN):
+            pytest.skip("Command '%s' not found. "
+                        "The test must not run remotely."
+                        % paths.SBIN_IPA_JOIN)
 
         # create a test host with bulk enrollment password
         host.track_create()
+
         del host.attrs['krbprincipalname']
         host.attrs['has_password'] = True
         objclass = list(set(
@@ -545,7 +550,7 @@ def test_join_host(self, host, keytabname):
 
         # joint the host with the bulk password
         new_args = [
-            join_command,
+            paths.SBIN_IPA_JOIN,
             "-s", host.api.env.host,
             "-h", host.fqdn,
             "-k", keytabname,

From 6537079defe10f5222388b4b96cb1b965ccd3e8a Mon Sep 17 00:00:00 2001
From: Lenka Doudova <ldoud...@redhat.com>
Date: Tue, 20 Sep 2016 09:15:36 +0200
Subject: [PATCH 2/2] Tests: Fix host attributes in ipa-join host test

Fixing discrepancies between returned and checked attributes in ipa-join host
test, that arose after recent changes in behavior.

https://fedorahosted.org/freeipa/ticket/6326
---
 ipatests/test_xmlrpc/test_host_plugin.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/ipatests/test_xmlrpc/test_host_plugin.py b/ipatests/test_xmlrpc/test_host_plugin.py
index 7e1dad0..279186b 100644
--- a/ipatests/test_xmlrpc/test_host_plugin.py
+++ b/ipatests/test_xmlrpc/test_host_plugin.py
@@ -533,7 +533,10 @@ def test_join_host(self, host, keytabname):
         # create a test host with bulk enrollment password
         host.track_create()
 
+        # manipulate host.attrs to correspond with real attributes of host
+        # after creating it with random password
         del host.attrs['krbprincipalname']
+        del host.attrs['krbcanonicalname']
         host.attrs['has_password'] = True
         objclass = list(set(
             host.attrs['objectclass']) - {u'krbprincipal', u'krbprincipalaux'})
@@ -565,10 +568,13 @@ def test_join_host(self, host, keytabname):
             # the keytab is not necessary for further tests
             print(e)
 
+        # fix host.attrs again to correspond with current state
         host.attrs['has_keytab'] = True
         host.attrs['has_password'] = False
         host.attrs['krbprincipalname'] = [u'host/%s@%s' % (host.fqdn,
                                                            host.api.env.realm)]
+        host.attrs['krbcanonicalname'] = [u'host/%s@%s' % (host.fqdn,
+                                                           host.api.env.realm)]
         host.retrieve()
 
         # Try to change the password of enrolled host with specified password
-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to