Exemple #1
0
 def test_modifications_fail_when_auth_required(self):
     backend._toggle_auth_required(self.ldapurl)
     connection = backend.initialize(self.ldapurl)
     connection.simple_bind_s()
     dn = 'uid=jradford,ou=users,%s' % self.root_dn
     mod_attrs = [( backend.MOD_ADD, 'testattr', 'TESTATTR' )]
     self.assertRaises(backend.STRONG_AUTH_REQUIRED, connection.modify_s, dn, mod_attrs)
Exemple #2
0
 def test_deletions_fail_when_auth_required(self):
     backend._toggle_auth_required(self.ldapurl)
     connection = backend.initialize(self.ldapurl)
     connection.simple_bind_s()
     dn = 'uid=jradford,ou=users,%s' % self.root_dn
     self.assertRaises(backend.STRONG_AUTH_REQUIRED, connection.delete_s,
                       dn)
Exemple #3
0
 def test_modifications_fail_when_auth_required(self):
     backend._toggle_auth_required(self.ldapurl)
     connection = backend.initialize(self.ldapurl)
     connection.simple_bind_s()
     dn = 'uid=jradford,ou=users,%s' % self.root_dn
     mod_attrs = [(backend.MOD_ADD, 'testattr', 'TESTATTR')]
     self.assertRaises(backend.STRONG_AUTH_REQUIRED, connection.modify_s,
                       dn, mod_attrs)
Exemple #4
0
 def test_search_fails_when_auth_required(self):
     backend._toggle_auth_required(self.ldapurl)
     connection = backend.initialize(self.ldapurl)
     connection.simple_bind_s()
     results = connection.search_s(self.root_dn)
     self.assertEqual(len(results), 0)
Exemple #5
0
 def test_setup_auth_required_for_backend_toggles_existing_root(self):
     self.failIf(backend._requires_auth(self.ldapurl))
     backend._toggle_auth_required(self.ldapurl)
     self.assert_(backend._requires_auth(self.ldapurl))
Exemple #6
0
 def test_setup_auth_required_for_backend(self):
     backend._toggle_auth_required('ldap://other.example.com')
     self.assert_(backend._requires_auth('ldap://other.example.com'))
Exemple #7
0
 def test_deletions_fail_when_auth_required(self):
     backend._toggle_auth_required(self.ldapurl)
     connection = backend.initialize(self.ldapurl)
     connection.simple_bind_s()
     dn = 'uid=jradford,ou=users,%s' % self.root_dn
     self.assertRaises(backend.STRONG_AUTH_REQUIRED, connection.delete_s, dn)
Exemple #8
0
 def test_search_fails_when_auth_required(self):
     backend._toggle_auth_required(self.ldapurl)
     connection = backend.initialize(self.ldapurl)
     connection.simple_bind_s()
     results = connection.search_s(self.root_dn)
     self.assertEqual(len(results), 0)
Exemple #9
0
 def test_setup_auth_required_for_backend_toggles_existing_root(self):
     self.failIf(backend._requires_auth(self.ldapurl))
     backend._toggle_auth_required(self.ldapurl)
     self.assert_(backend._requires_auth(self.ldapurl))
Exemple #10
0
 def test_setup_auth_required_for_backend(self):
     backend._toggle_auth_required('ldap://other.example.com')
     self.assert_(backend._requires_auth('ldap://other.example.com'))