On 18.8.2016 11:01, Martin Basti wrote:



On 18.08.2016 10:56, Petr Spacek wrote:
On 18.8.2016 10:08, Jan Cholasta wrote:
SSIA
Could you add one sentence or a link to a ticket which forced this
change?

When reading the patch, I have no way to say why the change is
necessary - so
it is impossible to verify correctness. (Sure, the test will pass, but
I have
no way to distinguish incorrect test passing on incorrect
implementation vs.
correct test passing on correct implementation.)

+1

and add there this link also https://fedorahosted.org/freeipa/ticket/6188

Updated patch attached.

--
Jan Cholasta
From aed35e08a8f61a022bcac6ef15d012566e081792 Mon Sep 17 00:00:00 2001
From: Jan Cholasta <jchol...@redhat.com>
Date: Thu, 18 Aug 2016 10:04:59 +0200
Subject: [PATCH] tests: fix test_ipalib.test_frontend.test_Object

Update the fake API object to match the real API object interface including
the changes introduced with the API compatibility feature.

https://fedorahosted.org/freeipa/ticket/6188
---
 ipatests/test_ipalib/test_frontend.py | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/ipatests/test_ipalib/test_frontend.py b/ipatests/test_ipalib/test_frontend.py
index 892328a..6a0e488 100644
--- a/ipatests/test_ipalib/test_frontend.py
+++ b/ipatests/test_ipalib/test_frontend.py
@@ -922,6 +922,9 @@ class test_Object(ClassChecker):
                     self.name = '%s_%s' % (obj_name, attr_name)
                 else:
                     self.name = name
+                self.bases = (DummyAttribute,)
+                self.version = '1'
+                self.full_name = '{}/{}'.format(self.name, self.version)
                 self.param = frontend.create_param(attr_name)
 
             def __clone__(self, attr_name):
@@ -940,15 +943,18 @@ class test_Object(ClassChecker):
         methods_format = 'method_%d'
 
         class FakeAPI(object):
-            Method = NameSpace(
-                get_attributes(cnt, methods_format)
-            )
+            def __init__(self):
+                self._API__plugins = get_attributes(cnt, methods_format)
+                self._API__default_map = {}
+                self.Method = plugable.APINameSpace(self, DummyAttribute)
             def __contains__(self, key):
                 return hasattr(self, key)
             def __getitem__(self, key):
                 return getattr(self, key)
             def is_production_mode(self):
                 return False
+            def _get(self, plugin):
+                return plugin
         api = FakeAPI()
         assert len(api.Method) == cnt * 3
 
-- 
2.7.4

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