s4:ldap.py - add a test for the "systemOnly" classes
authorMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
Sat, 3 Oct 2009 08:57:14 +0000 (10:57 +0200)
committerMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
Sat, 3 Oct 2009 08:57:14 +0000 (10:57 +0200)
source4/lib/ldb/tests/python/ldap.py

index c4ebb7e03d892115461beae9262646c49858ec70..7fa25fb43e8668f7b31ddfa01e250dfefaf16f5a 100755 (executable)
@@ -117,6 +117,21 @@ class BasicTests(unittest.TestCase):
         self.delete_force(self.ldb, "cn=parentguidtest,cn=users," + self.base_dn)
         self.delete_force(self.ldb, "cn=parentguidtest,cn=testotherusers," + self.base_dn)
         self.delete_force(self.ldb, "cn=testotherusers," + self.base_dn)
         self.delete_force(self.ldb, "cn=parentguidtest,cn=users," + self.base_dn)
         self.delete_force(self.ldb, "cn=parentguidtest,cn=testotherusers," + self.base_dn)
         self.delete_force(self.ldb, "cn=testotherusers," + self.base_dn)
+        self.delete_force(self.ldb, "cn=ldaptestobject," + self.base_dn)
+
+    def test_system_only(self):
+        """Test systemOnly objects"""
+        print "Test systemOnly objects"""
+
+        try:
+            self.ldb.add({
+                "dn": "cn=ldaptestobject," + self.base_dn,
+                "objectclass": "configuration"})
+            self.fail()
+        except LdbError, (num, _):
+            self.assertEquals(num, ERR_UNWILLING_TO_PERFORM)
+
+        self.delete_force(self.ldb, "cn=ldaptestobject," + self.base_dn)
 
     def test_invalid_attribute(self):
         """Test adding invalid attributes (not in schema)"""
 
     def test_invalid_attribute(self):
         """Test adding invalid attributes (not in schema)"""
@@ -136,7 +151,7 @@ class BasicTests(unittest.TestCase):
              "objectclass": "group"})
 
         m = Message()
              "objectclass": "group"})
 
         m = Message()
-        m.dn = Dn(ldb, "cn=ldaptestuser,cn=users," + self.base_dn)
+        m.dn = Dn(ldb, "cn=ldaptestgroup,cn=users," + self.base_dn)
         m["thisdoesnotexist"] = MessageElement("x", FLAG_MOD_REPLACE,
           "thisdoesnotexist")
         try:
         m["thisdoesnotexist"] = MessageElement("x", FLAG_MOD_REPLACE,
           "thisdoesnotexist")
         try: