Fix ldap2 shared connection

Since API is not singleton anymore, ldap2 connections should not be
shared by default.

https://fedorahosted.org/freeipa/ticket/4904

Reviewed-By: Jan Cholasta <jcholast@redhat.com>
This commit is contained in:
Martin Basti
2015-03-25 15:34:16 +01:00
committed by Jan Cholasta
parent c311af06f6
commit b92136cba2
3 changed files with 8 additions and 8 deletions

View File

@@ -76,7 +76,7 @@ class test_Connectible(ClassChecker):
object.__setattr__(self, 'args', args)
object.__setattr__(self, 'kw', kw)
return 'The connection.'
o = example()
o = example(shared_instance=True)
args = ('Arg1', 'Arg2', 'Arg3')
kw = dict(key1='Val1', key2='Val2', key3='Val3')
assert not hasattr(context, 'example')
@@ -104,7 +104,7 @@ class test_Connectible(ClassChecker):
class example(self.cls):
pass
for klass in (self.cls, example):
o = klass()
o = klass(shared_instance=True)
e = raises(NotImplementedError, o.create_connection)
assert str(e) == '%s.create_connection()' % klass.__name__
@@ -114,7 +114,7 @@ class test_Connectible(ClassChecker):
"""
class example(self.cls):
destroy_connection = Disconnect()
o = example()
o = example(shared_instance=True)
m = "disconnect: 'context.%s' does not exist in thread %r"
e = raises(StandardError, o.disconnect)
@@ -131,7 +131,7 @@ class test_Connectible(ClassChecker):
class example(self.cls):
pass
for klass in (self.cls, example):
o = klass()
o = klass(shared_instance=True)
e = raises(NotImplementedError, o.destroy_connection)
assert str(e) == '%s.destroy_connection()' % klass.__name__
@@ -142,7 +142,7 @@ class test_Connectible(ClassChecker):
class example(self.cls):
pass
for klass in (self.cls, example):
o = klass()
o = klass(shared_instance=True)
assert o.isconnected() is False
conn = 'whatever'
setattr(context, klass.__name__, conn)
@@ -157,7 +157,7 @@ class test_Connectible(ClassChecker):
class example(self.cls):
pass
for klass in (self.cls, example):
o = klass()
o = klass(shared_instance=True)
e = raises(AttributeError, getattr, o, 'conn')
assert str(e) == msg % (
klass.__name__, threading.currentThread().getName()