ldb: Add test showing a search against the index is not possible
authorAndrew Bartlett <abartlet@samba.org>
Wed, 13 Sep 2017 03:49:43 +0000 (15:49 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 22 Sep 2017 19:20:25 +0000 (21:20 +0200)
This is not actually a great test, as the filter would
fail to match these anyway, but it at least checks the
codepath is safe.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
lib/ldb/tests/python/api.py

index 62e885acee70ea18dd62a5212f8008552216bf5f..5cb848a7c82b67c29cca7aa7138f5365f232420b 100755 (executable)
@@ -950,6 +950,22 @@ class SearchTests(TestCase):
                               expression="(&(ou=ouX)(y=a))")
         self.assertEqual(len(res11), 0)
 
+    def test_subtree_and_idx_record(self):
+        """Testing a search against the index record"""
+
+        res11 = self.l.search(base="DC=SAMBA,DC=ORG",
+                              scope=ldb.SCOPE_SUBTREE,
+                              expression="(@IDXDN=DC=SAMBA,DC=ORG)")
+        self.assertEqual(len(res11), 0)
+
+    def test_subtree_and_idxone_record(self):
+        """Testing a search against the index record"""
+
+        res11 = self.l.search(base="DC=SAMBA,DC=ORG",
+                              scope=ldb.SCOPE_SUBTREE,
+                              expression="(@IDXONE=DC=SAMBA,DC=ORG)")
+        self.assertEqual(len(res11), 0)
+
 
 class IndexedSearchTests(SearchTests):
     """Test searches using the index, to ensure the index doesn't