tests: test ldap search requesting non-existent attribute
authorTim Beale <timbeale@catalyst.net.nz>
Fri, 14 Sep 2018 02:06:30 +0000 (14:06 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 21 Sep 2018 18:04:23 +0000 (20:04 +0200)
As an after-thought to commit 563e454e8c55e94a950, we thought it
might be a good idea to add a test case that requests an non-existent
attribute in the attribute-filter as well the search-filter.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/dsdb/tests/python/ldap.py

index affc3b85a3bc29c822542a4a5f3800e0d91f182a..37ccfb4edc7a3813de25cf61ce9b7f0cfcf5e783 100755 (executable)
@@ -637,6 +637,14 @@ class BasicTests(samba.tests.TestCase):
         self.assertTrue(len(res) == 1,
                         "Search including unknown attribute failed")
 
+        # likewise, if we specifically request an unknown attribute
+        res = ldb.search(base=self.base_dn,
+                         expression="(cn=ldaptestgroup)",
+                         scope=SCOPE_SUBTREE,
+                         attrs=["thisdoesnotexist"])
+        self.assertTrue(len(res) == 1,
+                        "Search requesting unknown attribute failed")
+
         delete_force(self.ldb, "cn=ldaptestgroup,cn=users," + self.base_dn)
 
         # attributes not in objectclasses and mandatory attributes missing test