summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2010-05-11 17:00:54 +0200
committerMatthias Dieter Wallnöfer <mdw@samba.org>2010-05-30 23:13:08 +0200
commitc30c4529f59f25e2846e33bdd3676aed51c10dcc (patch)
tree0233a193fec0754285ed00a6ba2017fa6929ca83 /source4
parentf3b04854b855e1547182bc36d57841dac3b041d8 (diff)
downloadsamba-c30c4529f59f25e2846e33bdd3676aed51c10dcc.tar.gz
samba-c30c4529f59f25e2846e33bdd3676aed51c10dcc.tar.bz2
samba-c30c4529f59f25e2846e33bdd3676aed51c10dcc.zip
s4:ldap.py - add more test cases to show invalid primary group change behaviour
Diffstat (limited to 'source4')
-rwxr-xr-xsource4/lib/ldb/tests/python/ldap.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/source4/lib/ldb/tests/python/ldap.py b/source4/lib/ldb/tests/python/ldap.py
index aa1febd285..a34801be94 100755
--- a/source4/lib/ldb/tests/python/ldap.py
+++ b/source4/lib/ldb/tests/python/ldap.py
@@ -659,6 +659,29 @@ objectClass: container
# self.assertEquals(num, ERR_UNWILLING_TO_PERFORM)
# self.delete_force(self.ldb, "cn=ldaptestuser,cn=users," + self.base_dn)
+ # Test to see how we should behave when the user account doesn't
+ # exist
+ m = Message()
+ m.dn = Dn(ldb, "cn=ldaptestuser,cn=users," + self.base_dn)
+ m["primaryGroupID"] = MessageElement("0", FLAG_MOD_REPLACE,
+ "primaryGroupID")
+ try:
+ ldb.modify(m)
+ self.fail()
+ except LdbError, (num, _):
+ self.assertEquals(num, ERR_NO_SUCH_OBJECT)
+
+ # Test to see how we should behave when the account isn't a user
+ m = Message()
+ m.dn = Dn(ldb, "cn=ldaptestgroup,cn=users," + self.base_dn)
+ m["primaryGroupID"] = MessageElement("0", FLAG_MOD_REPLACE,
+ "primaryGroupID")
+ try:
+ ldb.modify(m)
+ self.fail()
+ except LdbError, (num, _):
+ self.assertEquals(num, ERR_OBJECT_CLASS_VIOLATION)
+
ldb.add({
"dn": "cn=ldaptestuser,cn=users," + self.base_dn,
"objectclass": ["user", "person"]})