Ejemplo n.º 1
0
 def setUp(self):
     # Connecting to a fake server with a fake account:
     conn = fakeldap.FakeLDAPConnection()
     conn.simple_bind_s('Manager', 'some password')
     # We must explicitly create the base_dn DIT components
     fakeldap.addTreeItems(base_dn)
     # Adding a fake user, which is used in the tests
     self.person_attr = {
         'cn': [fakeuser['cn']],
         'uid': fakeuser['uid'],
         'userPassword': [fakeuser['hashedPassword']],
         'telephone': [fakeuser['telephone']],
         'objectClass': ['top']
     }
     conn.add_s(fakeuser['dn'], modlist.addModlist(self.person_attr))
     self.connection = conn
Ejemplo n.º 2
0
 def test_with_connection(self):
     conn = fakeldap.FakeLDAPConnection()
     LDAPAuthenticatorPlugin(conn, 'dc=example,dc=org')
Ejemplo n.º 3
0
 def test_without_base_dn(self):
     conn = fakeldap.FakeLDAPConnection()
     self.assertRaises(TypeError, LDAPAuthenticatorPlugin, conn)
     self.assertRaises(ValueError, LDAPAuthenticatorPlugin, conn, None)
Ejemplo n.º 4
0
 def test_connection_is_object(self):
     conn = fakeldap.FakeLDAPConnection()
     self.assertEqual(make_ldap_connection(conn), conn)