On 03.05.2016 11:18, Lenka Doudova wrote:


On 05/03/2016 10:33 AM, Martin Basti wrote:
Hello I'm quite confused what is happening in that code, can you explain it more to me? I see duplicated code there.
Sorry, that was just an unnecessary leftover. Fixed patch attached.
The code is expected to remove any certificates that were added to the local host but not to try to remove the host itself.

Lenka


Martin^2

Looks better, please follow proper naming of patches according how to format patch guide. I propose following (Patch attached) changes. It looks weird to me to return self object

Martin

From 35136b4dedcd1d5d4c32218f8f364e4de90ee5a3 Mon Sep 17 00:00:00 2001
From: Martin Basti <mba...@redhat.com>
Date: Tue, 3 May 2016 12:14:50 +0200
Subject: [PATCH] proposed changes

---
 ipatests/test_xmlrpc/test_host_plugin.py    | 3 ++-
 ipatests/test_xmlrpc/tracker/host_plugin.py | 4 +---
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/ipatests/test_xmlrpc/test_host_plugin.py b/ipatests/test_xmlrpc/test_host_plugin.py
index e29a83842398a2d2935e04a5a16eac504bc5d53d..be707d3567d9100254dee1706aa9921b6c2866e9 100644
--- a/ipatests/test_xmlrpc/test_host_plugin.py
+++ b/ipatests/test_xmlrpc/test_host_plugin.py
@@ -132,7 +132,8 @@ def this_host(request):
                           fqdn=api.env.host)
     tracker.exists = True
     # Fixture ensures that any certificates added to this_host are removed
-    return tracker.make_fixture_certcleanup(request)
+    tracker.add_finalizer_certcleanup(request)
+    return tracker
 
 
 @pytest.fixture(scope='class')
diff --git a/ipatests/test_xmlrpc/tracker/host_plugin.py b/ipatests/test_xmlrpc/tracker/host_plugin.py
index 6f268de5b85c92320fee62df51beeb7c896d0742..d8b59b98907dff955f415b6edb0ce34d74e54f19 100644
--- a/ipatests/test_xmlrpc/tracker/host_plugin.py
+++ b/ipatests/test_xmlrpc/tracker/host_plugin.py
@@ -157,7 +157,7 @@ class HostTracker(Tracker):
             result=self.filter_attrs(self.update_keys | set(extra_keys))
         ), result)
 
-    def make_fixture_certcleanup(self, request):
+    def add_finalizer_certcleanup(self, request):
         """ Fixture to cleanup certificate from local host """
         cleanup_command = self.make_update_command(
             updates={'usercertificate':''})
@@ -169,5 +169,3 @@ class HostTracker(Tracker):
                 pass
 
         request.addfinalizer(cleanup)
-
-        return self
-- 
2.5.5

-- 
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