summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorMatthieu Patou <mat@matws.net>2013-01-01 13:40:44 -0800
committerMatthieu Patou <mat@samba.org>2013-01-21 08:21:20 +0100
commite1ab7b68043c1f459541838c2b839bc7cb117c19 (patch)
tree36d77cb20db0401b125962d5cb010e05cf5ab45a /source4
parent853360b8e558f39218fc150ead367255f3a010b2 (diff)
downloadsamba-e1ab7b68043c1f459541838c2b839bc7cb117c19.tar.gz
samba-e1ab7b68043c1f459541838c2b839bc7cb117c19.tar.bz2
samba-e1ab7b68043c1f459541838c2b839bc7cb117c19.zip
Tests: rewrite ldap_schema to specify attributes
Signed-off-by: Matthieu Patou <mat@matws.net> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4')
-rwxr-xr-xsource4/dsdb/tests/python/ldap_schema.py39
1 files changed, 24 insertions, 15 deletions
diff --git a/source4/dsdb/tests/python/ldap_schema.py b/source4/dsdb/tests/python/ldap_schema.py
index d77f5537c9..fb0ef9ca56 100755
--- a/source4/dsdb/tests/python/ldap_schema.py
+++ b/source4/dsdb/tests/python/ldap_schema.py
@@ -67,8 +67,9 @@ class SchemaTests(samba.tests.TestCase):
def test_generated_schema_is_operational(self):
"""Testing we don't get the generated schema via LDAP by default"""
+ # Must keep the "*" form
res = self.ldb.search("cn=aggregate,"+self.schema_dn, scope=SCOPE_BASE,
- attrs=["*"])
+ attrs=["*"])
self.assertEquals(len(res), 1)
self.assertFalse("dITContentRules" in res[0])
self.assertFalse("objectClasses" in res[0])
@@ -106,7 +107,8 @@ schemaUpdateNow: 1
# Search for created attribute
res = []
- res = self.ldb.search("cn=%s,%s" % (attr_name, self.schema_dn), scope=SCOPE_BASE, attrs=["*"])
+ res = self.ldb.search("cn=%s,%s" % (attr_name, self.schema_dn), scope=SCOPE_BASE,
+ attrs=["lDAPDisplayName","schemaIDGUID"])
self.assertEquals(len(res), 1)
self.assertEquals(res[0]["lDAPDisplayName"][0], attr_ldap_display_name)
self.assertTrue("schemaIDGUID" in res[0])
@@ -160,7 +162,8 @@ systemOnly: FALSE
# Search for created objectclass
res = []
- res = self.ldb.search("cn=%s,%s" % (class_name, self.schema_dn), scope=SCOPE_BASE, attrs=["*"])
+ res = self.ldb.search("cn=%s,%s" % (class_name, self.schema_dn), scope=SCOPE_BASE,
+ attrs=["lDAPDisplayName", "defaultObjectCategory", "schemaIDGUID", "distinguishedName"])
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])
@@ -193,7 +196,7 @@ name: """ + object_name + """
# Search for created object
res = []
- res = self.ldb.search("cn=%s,cn=Users,%s" % (object_name, self.base_dn), scope=SCOPE_BASE, attrs=["*"])
+ res = self.ldb.search("cn=%s,cn=Users,%s" % (object_name, self.base_dn), scope=SCOPE_BASE, attrs=["dn"])
self.assertEquals(len(res), 1)
# Delete the object
delete_force(self.ldb, "cn=%s,cn=Users,%s" % (object_name, self.base_dn))
@@ -223,7 +226,9 @@ systemOnly: FALSE
# Search for created objectclass
res = []
- res = self.ldb.search("cn=%s,%s" % (class_name, self.schema_dn), scope=SCOPE_BASE, attrs=["*"])
+ res = self.ldb.search("cn=%s,%s" % (class_name, self.schema_dn), scope=SCOPE_BASE,
+ attrs=["lDAPDisplayName", "defaultObjectCategory",
+ "schemaIDGUID", "distinguishedName"])
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])
@@ -249,7 +254,7 @@ instanceType: 4
# Search for created object
res = []
- res = self.ldb.search("ou=%s,%s" % (object_name, self.base_dn), scope=SCOPE_BASE, attrs=["*"])
+ res = self.ldb.search("ou=%s,%s" % (object_name, self.base_dn), scope=SCOPE_BASE, attrs=["dn"])
self.assertEquals(len(res), 1)
# Delete the object
delete_force(self.ldb, "ou=%s,%s" % (object_name, self.base_dn))
@@ -260,7 +265,9 @@ class SchemaTests_msDS_IntId(samba.tests.TestCase):
def setUp(self):
super(SchemaTests_msDS_IntId, self).setUp()
self.ldb = ldb
- res = ldb.search(base="", expression="", scope=SCOPE_BASE, attrs=["*"])
+ res = ldb.search(base="", expression="", scope=SCOPE_BASE,
+ attrs=["schemaNamingContext", "defaultNamingContext",
+ "forestFunctionality"])
self.assertEquals(len(res), 1)
self.schema_dn = res[0]["schemaNamingContext"][0]
self.base_dn = res[0]["defaultNamingContext"][0]
@@ -339,7 +346,8 @@ systemOnly: FALSE
# Search for created attribute
res = []
- res = self.ldb.search(attr_dn, scope=SCOPE_BASE, attrs=["*"])
+ res = self.ldb.search(attr_dn, scope=SCOPE_BASE,
+ attrs=["lDAPDisplayName", "msDS-IntId", "systemFlags"])
self.assertEquals(len(res), 1)
self.assertEquals(res[0]["lDAPDisplayName"][0], attr_ldap_name)
if self.forest_level >= DS_DOMAIN_FUNCTION_2003:
@@ -381,7 +389,8 @@ systemOnly: FALSE
# Search for created attribute
res = []
- res = self.ldb.search(attr_dn, scope=SCOPE_BASE, attrs=["*"])
+ res = self.ldb.search(attr_dn, scope=SCOPE_BASE,
+ attrs=["lDAPDisplayName", "msDS-IntId"])
self.assertEquals(len(res), 1)
self.assertEquals(res[0]["lDAPDisplayName"][0], attr_ldap_name)
if self.forest_level >= DS_DOMAIN_FUNCTION_2003:
@@ -436,7 +445,7 @@ systemOnly: FALSE
self.ldb.add_ldif(ldif_add)
self._ldap_schemaUpdateNow()
- res = self.ldb.search(class_dn, scope=SCOPE_BASE, attrs=["*"])
+ res = self.ldb.search(class_dn, scope=SCOPE_BASE, attrs=["msDS-IntId"])
self.assertEquals(len(res), 1)
self.assertEquals(res[0]["msDS-IntId"][0], "-1993108831")
@@ -448,7 +457,7 @@ systemOnly: FALSE
self._ldap_schemaUpdateNow()
# Search for created Class
- res = self.ldb.search(class_dn, scope=SCOPE_BASE, attrs=["*"])
+ res = self.ldb.search(class_dn, scope=SCOPE_BASE, attrs=["msDS-IntId"])
self.assertEquals(len(res), 1)
self.assertFalse("msDS-IntId" in res[0])
@@ -473,7 +482,7 @@ systemOnly: FALSE
ldif_add = ldif + "msDS-IntId: -1993108831\n"
self.ldb.add_ldif(ldif_add)
- res = self.ldb.search(class_dn, scope=SCOPE_BASE, attrs=["*"])
+ res = self.ldb.search(class_dn, scope=SCOPE_BASE, attrs=["msDS-IntId"])
self.assertEquals(len(res), 1)
self.assertEquals(res[0]["msDS-IntId"][0], "-1993108831")
@@ -486,7 +495,7 @@ systemOnly: FALSE
self._ldap_schemaUpdateNow()
# Search for created Class
- res = self.ldb.search(class_dn, scope=SCOPE_BASE, attrs=["*"])
+ res = self.ldb.search(class_dn, scope=SCOPE_BASE, attrs=["msDS-IntId"])
self.assertEquals(len(res), 1)
self.assertFalse("msDS-IntId" in res[0])
@@ -498,7 +507,7 @@ systemOnly: FALSE
self.fail("Modifying msDS-IntId should return error")
except LdbError, (num, _):
self.assertEquals(num, ERR_CONSTRAINT_VIOLATION)
- res = self.ldb.search(class_dn, scope=SCOPE_BASE, attrs=["*"])
+ res = self.ldb.search(class_dn, scope=SCOPE_BASE, attrs=["msDS-IntId"])
self.assertEquals(len(res), 1)
self.assertFalse("msDS-IntId" in res[0])
@@ -532,7 +541,7 @@ class SchemaTests_msDS_isRODC(samba.tests.TestCase):
def setUp(self):
super(SchemaTests_msDS_isRODC, self).setUp()
self.ldb = ldb
- res = ldb.search(base="", expression="", scope=SCOPE_BASE, attrs=["*"])
+ res = ldb.search(base="", expression="", scope=SCOPE_BASE, attrs=["defaultNamingContext"])
self.assertEquals(len(res), 1)
self.base_dn = res[0]["defaultNamingContext"][0]