class LDAPDNTest(unittest.TestCase): def setUp(self): self.strdn = "cn=user,dc=test,dc=local" self.dn = LDAPDN(self.strdn) def tearDown(self): del self.dn def test_rdn(self): self.assertEqual(self.dn.get_rdn(0), "cn=user") def test_ancestors(self): self.assertEqual(self.dn.get_ancestors(), "dc=test,dc=local") def test_str(self): self.assertEqual(str(self.dn), self.strdn) def test_emptydn(self): empty = LDAPDN("") self.assertEqual(empty.get_ancestors(), "") def test_equel(self): self.assertEqual(self.dn, LDAPDN(self.strdn)) def test_rdns(self): self.assertEqual(self.dn.rdns[1], (("dc", "test"), )) def invalid(self): return LDAPDN("cn=test,dc=one+two") def test_invaliddn(self): self.assertRaises(errors.InvalidDN, self.invalid)
class LDAPDNTest(unittest.TestCase): def setUp(self): self.strdn = "cn=user,dc=test,dc=local" self.dn = LDAPDN(self.strdn) def tearDown(self): del self.dn def test_rdn(self): self.assertEqual(self.dn.get_rdn(0), "cn=user") def test_ancestors(self): self.assertEqual(self.dn.get_ancestors(), "dc=test,dc=local") def test_str(self): self.assertEqual(str(self.dn), self.strdn) def test_emptydn(self): empty = LDAPDN("") self.assertEqual(empty.get_ancestors(), "") def test_equel(self): self.assertEqual(self.dn, LDAPDN(self.strdn)) def test_rdns(self): self.assertEqual(self.dn.rdns[1], (("dc", "test"),)) def invalid(self): return LDAPDN("cn=test,dc=one+two") def test_invaliddn(self): self.assertRaises(errors.InvalidDN, self.invalid)
def setUp(self): self.strdn = "cn=user,dc=test,dc=local" self.dn = LDAPDN(self.strdn)
def invalid(self): return LDAPDN("cn=test,dc=one+two")
def test_equel(self): self.assertEqual(self.dn, LDAPDN(self.strdn))
def test_emptydn(self): empty = LDAPDN("") self.assertEqual(empty.get_ancestors(), "")
def test_bind_properties(self): self.assertEqual(self.url.basedn, LDAPDN("cn=test,dc=test")) self.assertEqual(self.url.scope, "base") self.assertEqual(self.url.filter, "(objectclass=*)") self.assertEqual(self.url.attributes, ["sn", "gn"])