diff options
author | Nadezhda Ivanova <nadezhda.ivanova@postpath.com> | 2010-01-07 12:34:06 +0200 |
---|---|---|
committer | Nadezhda Ivanova <nadezhda.ivanova@postpath.com> | 2010-01-07 12:34:06 +0200 |
commit | 309473f938d18b9993c2c4f120eeff7b4641985a (patch) | |
tree | c07dde840efd38b75a4b196b247c11946c3b57c9 /source4/lib/ldb/tests/python | |
parent | fb5383c69ee52fb5e6d066a43451dc8c806cc795 (diff) | |
parent | 71a40d7e2c21bf3ac47be3ec57fb091ff420ba9a (diff) | |
download | samba-309473f938d18b9993c2c4f120eeff7b4641985a.tar.gz samba-309473f938d18b9993c2c4f120eeff7b4641985a.tar.bz2 samba-309473f938d18b9993c2c4f120eeff7b4641985a.zip |
Merge branch 'master' of git://git.samba.org/samba
Diffstat (limited to 'source4/lib/ldb/tests/python')
-rwxr-xr-x | source4/lib/ldb/tests/python/ldap_schema.py | 55 |
1 files changed, 40 insertions, 15 deletions
diff --git a/source4/lib/ldb/tests/python/ldap_schema.py b/source4/lib/ldb/tests/python/ldap_schema.py index 0a31db82f7..9e54732104 100755 --- a/source4/lib/ldb/tests/python/ldap_schema.py +++ b/source4/lib/ldb/tests/python/ldap_schema.py @@ -132,9 +132,41 @@ systemOnly: FALSE """ self.ldb.add_ldif(ldif) + # Search for created attribute + res = [] + res = self.ldb.search("cn=%s,%s" % (attr_name, self.schema_dn), scope=SCOPE_BASE, attrs=["*"]) + self.assertEquals(len(res), 1) + self.assertEquals(res[0]["lDAPDisplayName"][0], attr_ldap_display_name) + self.assertTrue("schemaIDGUID" in res[0]) + class_name = "test-Class" + time.strftime("%s", time.gmtime()) class_ldap_display_name = class_name.replace("-", "") + # First try to create a class with a wrong "defaultObjectCategory" + ldif = """ +dn: CN=%s,%s""" % (class_name, self.schema_dn) + """ +objectClass: top +objectClass: classSchema +defaultObjectCategory: CN=_ +adminDescription: """ + class_name + """ +adminDisplayName: """ + class_name + """ +cn: """ + class_name + """ +governsId: 1.2.840.""" + str(random.randint(1,100000)) + """.1.5.9939 +instanceType: 4 +objectClassCategory: 1 +subClassOf: organizationalPerson +systemFlags: 16 +rDNAttID: cn +systemMustContain: cn +systemMustContain: """ + attr_ldap_display_name + """ +systemOnly: FALSE +""" + try: + self.ldb.add_ldif(ldif) + self.fail() + except LdbError, (num, _): + self.assertEquals(num, ERR_CONSTRAINT_VIOLATION) + ldif = """ dn: CN=%s,%s""" % (class_name, self.schema_dn) + """ objectClass: top @@ -154,6 +186,14 @@ systemOnly: FALSE """ self.ldb.add_ldif(ldif) + # Search for created objectclass + res = [] + res = self.ldb.search("cn=%s,%s" % (class_name, self.schema_dn), scope=SCOPE_BASE, attrs=["*"]) + self.assertEquals(len(res), 1) + self.assertEquals(res[0]["lDAPDisplayName"][0], class_ldap_display_name) + self.assertEquals(res[0]["defaultObjectCategory"][0], res[0]["distinguishedName"][0]) + self.assertTrue("schemaIDGUID" in res[0]) + ldif = """ dn: changetype: modify @@ -179,21 +219,6 @@ name: """ + object_name + """ """ self.ldb.add_ldif(ldif) - # Search for created attribute - res = [] - res = self.ldb.search("cn=%s,%s" % (attr_name, self.schema_dn), scope=SCOPE_BASE, attrs=["*"]) - self.assertEquals(len(res), 1) - self.assertEquals(res[0]["lDAPDisplayName"][0], attr_ldap_display_name) - self.assertTrue("schemaIDGUID" in res[0]) - - # Search for created objectclass - res = [] - res = self.ldb.search("cn=%s,%s" % (class_name, self.schema_dn), scope=SCOPE_BASE, attrs=["*"]) - self.assertEquals(len(res), 1) - self.assertEquals(res[0]["lDAPDisplayName"][0], class_ldap_display_name) - self.assertEquals(res[0]["defaultObjectCategory"][0], res[0]["distinguishedName"][0]) - self.assertTrue("schemaIDGUID" in res[0]) - # Search for created object res = [] res = self.ldb.search("cn=%s,cn=Users,%s" % (object_name, self.base_dn), scope=SCOPE_BASE, attrs=["*"]) |