mirielka's pull request #77: "Tests: Update host test with ipa-join" was opened

PR body:
"""
Updating path to ipa-join command to allow execution of
test_xmlrpc/test_host::TestHostFalsePwdChange::test_join_host. Fixing
discrepancies in returned and checked attributes.

https://fedorahosted.org/freeipa/ticket/6326
"""

See the full pull-request at https://github.com/freeipa/freeipa/pull/77
... or 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 915d38546ff73ff14e352b4d83b5e1e09a10e469 Mon Sep 17 00:00:00 2001
From: Lenka Doudova <ldoud...@redhat.com>
Date: Tue, 13 Sep 2016 14:50:55 +0200
Subject: [PATCH] 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. Fixing
discrepancies in returned and checked attributes.

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

diff --git a/ipatests/test_xmlrpc/test_host_plugin.py b/ipatests/test_xmlrpc/test_host_plugin.py
index 4ddabef..279186b 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,15 +521,22 @@ 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()
+
+        # 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'})
@@ -545,7 +553,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,
@@ -560,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