diff options
author | Jan Cholasta <jcholast@redhat.com> | 2015-06-22 10:58:43 +0000 |
---|---|---|
committer | Jan Cholasta <jcholast@redhat.com> | 2015-07-01 13:05:30 +0000 |
commit | e39fe4ed31042bd28357d093fdbd93b4d6d59aaa (patch) | |
tree | c9edd3b3d710ae642d91eb8ca0c060cb5f6d0f0c /ipatests/test_ipaserver | |
parent | 2d1515323acb4125306817096bafab6623de0b47 (diff) | |
download | freeipa-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_ipaserver')
-rw-r--r-- | ipatests/test_ipaserver/test_ldap.py | 10 | ||||
-rw-r--r-- | ipatests/test_ipaserver/test_rpcserver.py | 18 |
2 files changed, 17 insertions, 11 deletions
diff --git a/ipatests/test_ipaserver/test_ldap.py b/ipatests/test_ipaserver/test_ldap.py index 2c187b0c7..05ae87c1c 100644 --- a/ipatests/test_ipaserver/test_ldap.py +++ b/ipatests/test_ipaserver/test_ldap.py @@ -60,7 +60,7 @@ class test_ldap(object): """ Test an anonymous LDAP bind using ldap2 """ - self.conn = ldap2(shared_instance=False, ldap_uri=self.ldapuri) + self.conn = ldap2(api, ldap_uri=self.ldapuri) self.conn.connect() dn = api.env.basedn entry_attrs = self.conn.get_entry(dn, ['associateddomain']) @@ -73,7 +73,7 @@ class test_ldap(object): """ if not ipautil.file_exists(self.ccache): raise nose.SkipTest('Missing ccache %s' % self.ccache) - self.conn = ldap2(shared_instance=False, ldap_uri=self.ldapuri) + self.conn = ldap2(api, ldap_uri=self.ldapuri) self.conn.connect(ccache='FILE:%s' % self.ccache) entry_attrs = self.conn.get_entry(self.dn, ['usercertificate']) cert = entry_attrs.get('usercertificate') @@ -92,7 +92,7 @@ class test_ldap(object): fp.close() else: raise nose.SkipTest("No directory manager password in %s" % pwfile) - self.conn = ldap2(shared_instance=False, ldap_uri=self.ldapuri) + self.conn = ldap2(api, ldap_uri=self.ldapuri) self.conn.connect(bind_dn=DN(('cn', 'directory manager')), bind_pw=dm_password) entry_attrs = self.conn.get_entry(self.dn, ['usercertificate']) cert = entry_attrs.get('usercertificate') @@ -137,7 +137,7 @@ class test_ldap(object): Test an autobind LDAP bind using ldap2 """ ldapuri = 'ldapi://%%2fvar%%2frun%%2fslapd-%s.socket' % api.env.realm.replace('.','-') - self.conn = ldap2(shared_instance=False, ldap_uri=ldapuri) + self.conn = ldap2(api, ldap_uri=ldapuri) try: self.conn.connect(autobind=True) except errors.ACIError: @@ -160,7 +160,7 @@ class test_LDAPEntry(object): def setup(self): self.ldapuri = 'ldap://%s' % ipautil.format_netloc(api.env.host) - self.conn = ldap2(shared_instance=False, ldap_uri=self.ldapuri) + self.conn = ldap2(api, ldap_uri=self.ldapuri) self.conn.connect() self.entry = self.conn.make_entry(self.dn1, cn=self.cn1) diff --git a/ipatests/test_ipaserver/test_rpcserver.py b/ipatests/test_ipaserver/test_rpcserver.py index 08d773c3d..c77c2d97c 100644 --- a/ipatests/test_ipaserver/test_rpcserver.py +++ b/ipatests/test_ipaserver/test_rpcserver.py @@ -47,7 +47,8 @@ class StartResponse(object): def test_not_found(): - f = rpcserver.HTTP_Status() + api = 'the api instance' + f = rpcserver.HTTP_Status(api) t = rpcserver._not_found_template s = StartResponse() @@ -72,7 +73,8 @@ def test_not_found(): def test_bad_request(): - f = rpcserver.HTTP_Status() + api = 'the api instance' + f = rpcserver.HTTP_Status(api) t = rpcserver._bad_request_template s = StartResponse() @@ -85,7 +87,8 @@ def test_bad_request(): def test_internal_error(): - f = rpcserver.HTTP_Status() + api = 'the api instance' + f = rpcserver.HTTP_Status(api) t = rpcserver._internal_error_template s = StartResponse() @@ -98,7 +101,8 @@ def test_internal_error(): def test_unauthorized_error(): - f = rpcserver.HTTP_Status() + api = 'the api instance' + f = rpcserver.HTTP_Status(api) t = rpcserver._unauthorized_template s = StartResponse() @@ -139,7 +143,8 @@ class test_session(object): [environ[k] for k in ('SCRIPT_NAME', 'PATH_INFO')] ) - inst = self.klass() + api = 'the api instance' + inst = self.klass(api) inst.mount(app1, '/foo/stuff') inst.mount(app2, '/bar') @@ -157,7 +162,8 @@ class test_session(object): pass # Test that mount works: - inst = self.klass() + api = 'the api instance' + inst = self.klass(api) inst.mount(app1, 'foo') assert inst['foo'] is app1 assert list(inst) == ['foo'] |