From b2db28b634bceccb4c87e3f764649a5ed1f3217a Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 7 Dec 2009 12:44:07 +1100 Subject: s4:ldap.py Improve testsuite for primaryGroupToken behaviour This tries to show that the domain object should not have a primaryGroupToken, for example. (This passes against the old and new code, as the failure case requires an object with an objectSid, and exactly one group in it's subtree. Sadly I don't know of a valid structure that I can construct to test this). Andrew Bartlett --- source4/lib/ldb/tests/python/ldap.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'source4') diff --git a/source4/lib/ldb/tests/python/ldap.py b/source4/lib/ldb/tests/python/ldap.py index 384e69e9bdc..d0a0ed2da57 100755 --- a/source4/lib/ldb/tests/python/ldap.py +++ b/source4/lib/ldb/tests/python/ldap.py @@ -806,6 +806,28 @@ objectClass: container "dn": "cn=ldaptestgroup,cn=users," + self.base_dn, "objectclass": "group"}) + # Testing for one invalid, and one valid operational attribute, but also the things they are built from + res1 = ldb.search(self.base_dn, + scope=SCOPE_BASE, attrs=["primaryGroupToken", "canonicalName", "objectClass", "objectSid"]) + self.assertTrue(len(res1) == 1) + self.assertFalse("primaryGroupToken" in res1[0]) + self.assertTrue("canonicalName" in res1[0]) + self.assertTrue("objectClass" in res1[0]) + self.assertTrue("objectSid" in res1[0]) + + res1 = ldb.search(self.base_dn, + scope=SCOPE_BASE, attrs=["primaryGroupToken", "canonicalName"]) + self.assertTrue(len(res1) == 1) + self.assertFalse("primaryGroupToken" in res1[0]) + self.assertFalse("objectSid" in res1[0]) + self.assertFalse("objectClass" in res1[0]) + self.assertTrue("canonicalName" in res1[0]) + + res1 = ldb.search("cn=users,"+self.base_dn, + scope=SCOPE_BASE, attrs=["primaryGroupToken"]) + self.assertTrue(len(res1) == 1) + self.assertFalse("primaryGroupToken" in res1[0]) + res1 = ldb.search("cn=ldaptestuser, cn=users," + self.base_dn, scope=SCOPE_BASE, attrs=["primaryGroupToken"]) self.assertTrue(len(res1) == 1) -- cgit v1.2.1