summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2008-08-15 20:40:57 +1000
committerAndrew Bartlett <abartlet@samba.org>2008-08-15 20:40:57 +1000
commit16112762e70879b50f1dfc49452d6d278bd256cf (patch)
tree19e91c832a8069686a1c5ba92cc28d73cc3ba815 /source4/lib
parente387677f515ee7f2c185069f8c52a3ec783041e2 (diff)
downloadsamba-16112762e70879b50f1dfc49452d6d278bd256cf.tar.gz
samba-16112762e70879b50f1dfc49452d6d278bd256cf.tar.bz2
samba-16112762e70879b50f1dfc49452d6d278bd256cf.zip
Generate the subSchema in cn=Aggregate
This reads the schema from the in-memory structure, when the magic attributes are requested. The code is a modified version of that used in the ad2oLschema tool (now shared). The schema_fsmo module handles the insertion of the generated result. As such, this commit also removes these entries from the setup/schema.ldif Metze's previous stub of this functionality is also removed. Andrew Bartlett (This used to be commit c7c32ec7b42bdf0f7b669644516438c71b364e60)
Diffstat (limited to 'source4/lib')
-rwxr-xr-xsource4/lib/ldb/tests/python/ldap.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/source4/lib/ldb/tests/python/ldap.py b/source4/lib/ldb/tests/python/ldap.py
index 042469602c..13d4adf6d4 100755
--- a/source4/lib/ldb/tests/python/ldap.py
+++ b/source4/lib/ldb/tests/python/ldap.py
@@ -970,6 +970,34 @@ class BaseDnTests(unittest.TestCase):
attrs=["netlogon", "highestCommittedUSN"])
self.assertEquals(len(res), 0)
+class SchemaTests(unittest.TestCase):
+ def find_schemadn(self, ldb):
+ res = ldb.search(base="", expression="", scope=SCOPE_BASE, attrs=["schemaNamingContext"])
+ self.assertEquals(len(res), 1)
+ return res[0]["schemaNamingContext"][0]
+
+ def setUp(self):
+ self.ldb = ldb
+ self.schema_dn = self.find_schemadn(ldb)
+
+ def test_generated_schema(self):
+ """Testing we can read the generated schema via LDAP"""
+ res = self.ldb.search("cn=aggregate,"+self.schema_dn, scope=SCOPE_BASE,
+ attrs=["objectClasses", "attributeTypes", "dITContentRules"])
+ self.assertEquals(len(res), 1)
+ self.assertTrue("dITContentRules" in res[0])
+ self.assertTrue("objectClasses" in res[0])
+ self.assertTrue("attributeTypes" in res[0])
+
+ def test_generated_schema_is_operational(self):
+ """Testing we don't get the generated schema via LDAP by default"""
+ res = self.ldb.search("cn=aggregate,"+self.schema_dn, scope=SCOPE_BASE,
+ attrs=["*"])
+ self.assertEquals(len(res), 1)
+ self.assertFalse("dITContentRules" in res[0])
+ self.assertFalse("objectClasses" in res[0])
+ self.assertFalse("attributeTypes" in res[0])
+
if not "://" in host:
host = "ldap://%s" % host
@@ -983,4 +1011,6 @@ if not runner.run(unittest.makeSuite(BaseDnTests)).wasSuccessful():
rc = 1
if not runner.run(unittest.makeSuite(BasicTests)).wasSuccessful():
rc = 1
+if not runner.run(unittest.makeSuite(SchemaTests)).wasSuccessful():
+ rc = 1
sys.exit(rc)