Author: jelmer Date: 2007-10-14 18:30:51 +0000 (Sun, 14 Oct 2007) New Revision: 25634
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=25634 Log: Implement is_valid, is_special, check_special and is_null on dn's. Modified: branches/4.0-python/ branches/4.0-python/source/lib/ldb/swig/ldb.i branches/4.0-python/source/lib/ldb/tests/python/api.py Changeset: Property changes on: branches/4.0-python ___________________________________________________________________ Name: bzr:revision-info ...skipped... Name: bzr:revision-id:v3-trunk0 ...skipped... Modified: branches/4.0-python/source/lib/ldb/swig/ldb.i =================================================================== --- branches/4.0-python/source/lib/ldb/swig/ldb.i 2007-10-14 18:22:48 UTC (rev 25633) +++ branches/4.0-python/source/lib/ldb/swig/ldb.i 2007-10-14 18:30:51 UTC (rev 25634) @@ -147,9 +147,15 @@ const char *get_linearized(); ldb_dn *parent() { return ldb_dn_get_parent(NULL, $self); } int compare(ldb_dn *other); + bool is_valid(); + bool is_special(); + bool is_null(); + bool check_special(const char *name); } } ldb_dn; +/* ldb_message */ + %rename(Message) ldb_message; %rename(__delitem__) ldb_message::remove_attr; Modified: branches/4.0-python/source/lib/ldb/tests/python/api.py =================================================================== --- branches/4.0-python/source/lib/ldb/tests/python/api.py 2007-10-14 18:22:48 UTC (rev 25633) +++ branches/4.0-python/source/lib/ldb/tests/python/api.py 2007-10-14 18:30:51 UTC (rev 25634) @@ -67,7 +67,27 @@ z = ldb.Dn(self.ldb, "dc=foo,bar=blie") self.assertNotEquals(z, y) + def test_is_valid(self): + x = ldb.Dn(self.ldb, "dc=foo,dc=bloe") + self.assertTrue(x.is_valid()) + x = ldb.Dn(self.ldb, "") + # is_valid()'s return values appears to be a side effect of + # some other ldb functions. yuck. + # self.assertFalse(x.is_valid()) + def test_is_special(self): + x = ldb.Dn(self.ldb, "dc=foo,bar=bloe") + self.assertFalse(x.is_special()) + x = ldb.Dn(self.ldb, "@FOOBAR") + self.assertTrue(x.is_special()) + + def test_check_special(self): + x = ldb.Dn(self.ldb, "dc=foo,bar=bloe") + self.assertFalse(x.check_special("FOOBAR")) + x = ldb.Dn(self.ldb, "@FOOBAR") + self.assertTrue(x.check_special("@FOOBAR")) + + class LdbMsgTests(unittest.TestCase): def setUp(self): self.msg = ldb.Message()
