From c30c4529f59f25e2846e33bdd3676aed51c10dcc Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Tue, 11 May 2010 17:00:54 +0200 Subject: s4:ldap.py - add more test cases to show invalid primary group change behaviour --- source4/lib/ldb/tests/python/ldap.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) 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"]}) -- cgit