summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2009-12-07 12:44:07 +1100
committerAndrew Bartlett <abartlet@samba.org>2009-12-07 13:08:06 +1100
commitb2db28b634bceccb4c87e3f764649a5ed1f3217a (patch)
treec6ca30824ba0aaf69ac7b9caa86081a2e6ff29df
parent354b80b3ae3fd918d65f6425d054630d51ee18e0 (diff)
downloadsamba-b2db28b634bceccb4c87e3f764649a5ed1f3217a.tar.gz
samba-b2db28b634bceccb4c87e3f764649a5ed1f3217a.tar.bz2
samba-b2db28b634bceccb4c87e3f764649a5ed1f3217a.zip
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
-rwxr-xr-xsource4/lib/ldb/tests/python/ldap.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/source4/lib/ldb/tests/python/ldap.py b/source4/lib/ldb/tests/python/ldap.py
index 384e69e9bd..d0a0ed2da5 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)