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)
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)
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)
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)
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))
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'))