Commit 3aa97008 authored by Lorenz Steinert's avatar Lorenz Steinert

ldap.Connection no mocked

parent bc7b54e0
......@@ -32,9 +32,14 @@ class FsrLdapTest(unittest.TestCase):
open("/tmp/python3-esme-testing/fsr_extern", 'a').close()
self.sharedir = "/tmp/python3-esme-testing"
self.conn = ldap.Connection(self.test_ldap_server.server, client_strategy=ldap.MOCK_SYNC)
self.conn_non = ldap.Connection('', client_strategy=ldap.MOCK_SYNC)
def con(self, *arg):
return self.conn
def con_non(self, *arg):
return self.conn_non
def test_get_fsr_ldap(self):
"""test the get_fsr_ldap function"""
ldap.Connection = self.con
......@@ -50,7 +55,7 @@ class FsrLdapTest(unittest.TestCase):
def test_get_protokollant_ldap(self):
ldap.Connection = self.con
esme.current_user = lambda: 'testing test1'
self.assertEqual(self.test_ldap_server.get_protokollant_ldap({'PROTOKOLL': {'Protokollant': 'testing test3'}}), 'testing test1')
self.assertEqual(self.test_ldap_server.get_protokollant_ldap({'PROTOKOLL': {'Protokollant': 'testing test3'}}), 'testing test1')
def test_get_fsr_ldap_no_server(self):
"""test the get_fsr_ldap function without ldap connection"""
......@@ -67,7 +72,7 @@ class FsrLdapTest(unittest.TestCase):
def test_get_protokollant_ldap_no_server(self):
ldap.Connection = self.con_non
esme.current_user = lambda: 'testing test1'
self.assertEqual(self.test_ldap_server.get_protokollant_ldap({'PROTOKOLL': {'Protokollant': 'testing test3'}}), 'testing test3')
self.assertEqual(self.test_ldap_server.get_protokollant_ldap({'PROTOKOLL': {'Protokollant': 'testing test3'}}), 'testing test3')
def tearDown(self):
"""cleanup after the tests"""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment