[Zope-Checkins] CVS: Zope/lib/python/Zope/Startup/tests - test_schema.py:1.2.2.2

Fred L. Drake, Jr. fred@zope.com
Tue, 25 Feb 2003 11:43:15 -0500


Update of /cvs-repository/Zope/lib/python/Zope/Startup/tests
In directory cvs.zope.org:/tmp/cvs-serv3843

Modified Files:
      Tag: new-install-branch
	test_schema.py 
Log Message:
Add a test that the configuration template is loadable.


=== Zope/lib/python/Zope/Startup/tests/test_schema.py 1.2.2.1 => 1.2.2.2 ===
--- Zope/lib/python/Zope/Startup/tests/test_schema.py:1.2.2.1	Fri Feb 21 11:31:34 2003
+++ Zope/lib/python/Zope/Startup/tests/test_schema.py	Tue Feb 25 11:43:15 2003
@@ -15,26 +15,38 @@
 """Test that the Zope schema can be loaded."""
 
 import os
-import StringIO
+import cStringIO
 import tempfile
 import unittest
 
 import ZConfig
 import Zope.Startup
 
+from App.config import getConfiguration
+
 
 class StartupTestCase(unittest.TestCase):
 
     def test_load_schema(self):
         Zope.Startup.getSchema()
 
+    def test_load_config_template(self):
+        schema = Zope.Startup.getSchema()
+        cfg = getConfiguration()
+        fn = os.path.join(cfg.zopehome, "skel", "etc", "zope.conf.in")
+        f = open(fn)
+        text = f.read()
+        f.close()
+        text = text.replace("<<INSTANCE_HOME>>", cfg.instancehome)
+        ZConfig.loadConfigFile(schema, cStringIO.StringIO(text))
+
     def test_cgi_environment(self):
         schema = Zope.Startup.getSchema()
         # We have to create a directory of our own since the existence
         # of the directory is checked.  This handles this in a
         # platform-independent way.
         dn = tempfile.mktemp()
-        sio = StringIO.StringIO("""\
+        sio = cStringIO.StringIO("""\
             # instancehome is here since it's required
             instancehome %s
             <cgi-environment>