unittests: add a test to avoid regression on previous fix
authorMatthieu Patou <mat@matws.net>
Mon, 4 Oct 2010 18:56:20 +0000 (22:56 +0400)
committerMatthieu Patou <mat@sn-devel-104.sn.samba.org>
Mon, 4 Oct 2010 20:23:31 +0000 (20:23 +0000)
Autobuild-User: Matthieu Patou <mat@samba.org>
Autobuild-Date: Mon Oct  4 20:23:31 UTC 2010 on sn-devel-104

source4/lib/ldb/tests/python/api.py

index 4b4415afb1f6cbe7fcb23bd301182c65793aa7de..76de853ac7cba80fce94ef4abc416ab4c52de0f1 100755 (executable)
@@ -7,6 +7,7 @@ import unittest
 
 import ldb
 
+
 def filename():
     return os.tempnam()
 
@@ -321,6 +322,10 @@ class SimpleLdb(unittest.TestCase):
         res = l.search(expression="(dn=dc=somedn)")
         self.assertEquals("foo\0bar", res[0]["displayname"][0])
 
+    def test_no_crash_broken_expr(self):
+        l = ldb.Ldb(filename())
+        self.assertRaises(ldb.LdbError,lambda: l.search("", ldb.SCOPE_SUBTREE, "&(dc=*)(dn=*)", ["dc"]))
+
 
 class DnTests(unittest.TestCase):