s4:ldap.py - additional "instanceType" checks
authorMatthias Dieter Wallnöfer <mdw@samba.org>
Sun, 1 Aug 2010 19:12:50 +0000 (21:12 +0200)
committerMatthias Dieter Wallnöfer <mdw@samba.org>
Sun, 1 Aug 2010 19:30:30 +0000 (21:30 +0200)
source4/dsdb/tests/python/ldap.py

index ea0aa3a3f93599da3491b6ef4cc040fc16c9589a..728c537015e184cda2f1302485a8464a0ca15499 100755 (executable)
@@ -658,6 +658,7 @@ class BasicTests(unittest.TestCase):
         """Tests the 'instanceType' attribute"""
         print "Tests the 'instanceType' attribute"""
 
+        # The instance type is single-valued
         try:
             self.ldb.add({
                 "dn": "cn=ldaptestgroup,cn=users," + self.base_dn,
@@ -667,6 +668,28 @@ class BasicTests(unittest.TestCase):
         except LdbError, (num, _):
             self.assertEquals(num, ERR_UNWILLING_TO_PERFORM)
 
+        # The head NC flag cannot be set without the write flag
+        try:
+            self.ldb.add({
+                "dn": "cn=ldaptestgroup,cn=users," + self.base_dn,
+                "objectclass": "group",
+                "instanceType": "1" })
+            self.fail()
+        except LdbError, (num, _):
+            self.assertEquals(num, ERR_UNWILLING_TO_PERFORM)
+
+        # We cannot manipulate NCs without the head NC flag
+        try:
+            self.ldb.add({
+                "dn": "cn=ldaptestgroup,cn=users," + self.base_dn,
+                "objectclass": "group",
+                "instanceType": "32" })
+            self.fail()
+        except LdbError, (num, _):
+            self.assertEquals(num, ERR_UNWILLING_TO_PERFORM)
+
+
+
         self.ldb.add({
              "dn": "cn=ldaptestgroup,cn=users," + self.base_dn,
              "objectclass": "group"})