summaryrefslogtreecommitdiffstats
path: root/ipatests/test_xmlrpc
diff options
context:
space:
mode:
authorJan Cholasta <jcholast@redhat.com>2015-06-22 10:58:43 +0000
committerJan Cholasta <jcholast@redhat.com>2015-07-01 13:05:30 +0000
commite39fe4ed31042bd28357d093fdbd93b4d6d59aaa (patch)
treec9edd3b3d710ae642d91eb8ca0c060cb5f6d0f0c /ipatests/test_xmlrpc
parent2d1515323acb4125306817096bafab6623de0b47 (diff)
downloadfreeipa-e39fe4ed31042bd28357d093fdbd93b4d6d59aaa.tar.gz
freeipa-e39fe4ed31042bd28357d093fdbd93b4d6d59aaa.tar.xz
freeipa-e39fe4ed31042bd28357d093fdbd93b4d6d59aaa.zip
plugable: Pass API to plugins on initialization rather than using set_api
https://fedorahosted.org/freeipa/ticket/3090 Reviewed-By: Martin Babinsky <mbabinsk@redhat.com>
Diffstat (limited to 'ipatests/test_xmlrpc')
-rw-r--r--ipatests/test_xmlrpc/test_baseldap_plugin.py15
-rw-r--r--ipatests/test_xmlrpc/test_dns_plugin.py2
-rw-r--r--ipatests/test_xmlrpc/test_netgroup_plugin.py2
-rw-r--r--ipatests/test_xmlrpc/test_permission_plugin.py2
-rw-r--r--ipatests/test_xmlrpc/testcert.py2
5 files changed, 14 insertions, 9 deletions
diff --git a/ipatests/test_xmlrpc/test_baseldap_plugin.py b/ipatests/test_xmlrpc/test_baseldap_plugin.py
index 6b19e57c1..6da56262b 100644
--- a/ipatests/test_xmlrpc/test_baseldap_plugin.py
+++ b/ipatests/test_xmlrpc/test_baseldap_plugin.py
@@ -44,7 +44,8 @@ def test_exc_wrapper():
assert kwargs == dict(a=1, b=2)
raise errors.ExecutionError('failure')
- instance = test_callback()
+ api = 'the api instance'
+ instance = test_callback(api)
# Test with one callback first
@@ -96,8 +97,10 @@ def test_callback_registration():
callbacktest_subclass.register_callback('test', subclass_callback)
+ api = 'the api instance'
+
messages = []
- instance = callbacktest_base()
+ instance = callbacktest_base(api)
for callback in instance.get_callbacks('test'):
callback(instance, 42)
assert messages == [
@@ -106,7 +109,7 @@ def test_callback_registration():
('Registered callback from another class', 42)]
messages = []
- instance = callbacktest_subclass()
+ instance = callbacktest_subclass(api)
for callback in instance.get_callbacks('test'):
callback(instance, 42)
assert messages == [
@@ -134,7 +137,9 @@ def test_exc_callback_registration():
"""Raise an error"""
raise errors.ExecutionError('failure')
- base_instance = callbacktest_base()
+ api = 'the api instance'
+
+ base_instance = callbacktest_base(api)
class callbacktest_subclass(callbacktest_base):
pass
@@ -145,7 +150,7 @@ def test_exc_callback_registration():
messages.append('Subclass registered callback')
raise exc
- subclass_instance = callbacktest_subclass()
+ subclass_instance = callbacktest_subclass(api)
# Make sure exception in base class is only handled by the base class
base_instance.test_fail()
diff --git a/ipatests/test_xmlrpc/test_dns_plugin.py b/ipatests/test_xmlrpc/test_dns_plugin.py
index e38ea424d..83b5b2aec 100644
--- a/ipatests/test_xmlrpc/test_dns_plugin.py
+++ b/ipatests/test_xmlrpc/test_dns_plugin.py
@@ -400,7 +400,7 @@ def _get_nameservers_ldap(conn):
def get_nameservers():
- ldap = ldap2(shared_instance=False)
+ ldap = ldap2(api)
ldap.connect(ccache=krbV.default_context().default_ccache())
nameservers = [normalize_zone(x) for x in _get_nameservers_ldap(ldap)]
return nameservers
diff --git a/ipatests/test_xmlrpc/test_netgroup_plugin.py b/ipatests/test_xmlrpc/test_netgroup_plugin.py
index 162879884..64cc42210 100644
--- a/ipatests/test_xmlrpc/test_netgroup_plugin.py
+++ b/ipatests/test_xmlrpc/test_netgroup_plugin.py
@@ -1297,7 +1297,7 @@ class test_netgroup(Declarative):
# """
# # Do an LDAP query to the compat area and verify that the entry
# # is correct
-# conn = ldap2(shared_instance=False, ldap_uri=api.env.ldap_uri, base_dn=api.env.basedn)
+# conn = ldap2(api)
# conn.connect(ccache=ccache)
# try:
# entries = conn.find_entries('cn=%s' % self.ng_cn,
diff --git a/ipatests/test_xmlrpc/test_permission_plugin.py b/ipatests/test_xmlrpc/test_permission_plugin.py
index 4503b0d5a..c899c428e 100644
--- a/ipatests/test_xmlrpc/test_permission_plugin.py
+++ b/ipatests/test_xmlrpc/test_permission_plugin.py
@@ -3174,7 +3174,7 @@ class test_managed_permissions(Declarative):
def add_managed_permission(self):
"""Add a managed permission and the corresponding ACI"""
- ldap = ldap2(shared_instance=False)
+ ldap = ldap2(api)
ldap.connect(ccache=krbV.default_context().default_ccache())
result = api.Command.permission_add(permission1, type=u'user',
diff --git a/ipatests/test_xmlrpc/testcert.py b/ipatests/test_xmlrpc/testcert.py
index 4afd38d2c..b9a01118d 100644
--- a/ipatests/test_xmlrpc/testcert.py
+++ b/ipatests/test_xmlrpc/testcert.py
@@ -74,7 +74,7 @@ def makecert(reqdir, subject, principal):
Generate a certificate that can be used during unit testing.
"""
- ra = rabase.rabase()
+ ra = rabase.rabase(api)
if (not os.path.exists(ra.sec_dir) and
api.env.xmlrpc_uri == 'http://localhost:8888/ipa/xml'):
raise AssertionError('The self-signed CA is not configured, '