[Zodb-checkins] CVS: Packages/ZConfig/tests - test_zopeschema.py:1.1.2.2

Chris McDonough chrism@zope.com
Thu, 19 Dec 2002 17:11:53 -0500


Update of /cvs-repository/Packages/ZConfig/tests
In directory cvs.zope.org:/tmp/cvs-serv8839

Modified Files:
      Tag: zconfig-schema-devel-branch
	test_zopeschema.py 
Log Message:
Success in fully populated schema test.


=== Packages/ZConfig/tests/test_zopeschema.py 1.1.2.1 => 1.1.2.2 ===
--- Packages/ZConfig/tests/test_zopeschema.py:1.1.2.1	Thu Dec 19 15:41:39 2002
+++ Packages/ZConfig/tests/test_zopeschema.py	Thu Dec 19 17:11:22 2002
@@ -18,6 +18,12 @@
 
 from ZConfig.tests.test_schema import SchemaTestCase
 
+try:
+    True
+except NameError:
+    True = 1
+    False = 0
+    
 class StreamHandler:
     pass
 
@@ -108,9 +114,83 @@
 
     # tests
 
-    def test_load_zope_schema(self):
+    def test_load_populated(self):
         schema = self.load_schema('zope.xml')
         conf = self.load_config(schema, 'zope-allpopulated.conf')
+        self.assertEqual(conf.zope_home, 'foo')
+        self.assertEqual(conf.instance_home, 'bar')
+        self.assertEqual(conf.software_home, 'foo/lib/python')
+        self.assertEqual(conf.client_home, 'instance_home/var')
+        self.assertEqual(conf.debug_mode, True)
+        self.assertEqual(conf.effective_user, 'chrism')
+        self.assertEqual(conf.enable_product_installation, True)
+        self.assertEqual(conf.locale, None)
+        self.assertEqual(conf.zserver_threads, 4)
+        self.assertEqual(conf.python_check_interval, 500)
+        self.assertEqual(conf.use_daemon_process, True)
+        self.assertEqual(conf.zserver_read_only_mode, False)
+        self.assertEqual(conf.pid_filename, 'Z2.pid')
+        self.assertEqual(conf.lock_filename, 'Z2.lock')
+        constructor = ('ZConfig.tests.test_zopeschema.StreamHandler', [], {})
+        formatter   = ('ZConfig.tests.test_zopeschema.Formatter', [], {})
+        self.assertEqual(conf.event.level, 10)
+        self.assertEqual(conf.event.handlers[0].constructor, constructor)
+        self.assertEqual(conf.event.handlers[0].formatter, formatter)
+        self.assertEqual(conf.event.handlers[1].constructor, constructor)
+        self.assertEqual(conf.event.handlers[1].formatter, formatter)
+        self.assertEqual(conf.trace.level, 20)
+        self.assertEqual(conf.trace.handlers[0].constructor, constructor)
+        self.assertEqual(conf.trace.handlers[0].formatter, formatter)
+        self.assertEqual(conf.access.level, 30)
+        self.assertEqual(conf.access.handlers[0].constructor, constructor)
+        self.assertEqual(conf.access.handlers[0].formatter, formatter)
+        self.assertEqual(conf.structured_text_header_level, 3)
+        self.assertEqual(conf.maximum_security_manager_stack_size, 100)
+        self.assertEqual(conf.publisher_profile_file, 'bleah')
+        self.assertEqual(conf.module, 'Zope')
+        self.assertEqual(conf.cgi_environment_variables, ['A 1', 'B 2'])
+        self.assertEqual(conf.dns_ip_address, '127.0.0.1')
+        self.assertEqual(conf.http_realm, 'Zope')
+        servers = conf.servers
+        for n in range(len(servers)):
+            if n == 0:
+                self.assertEqual(servers[n].port, 8080)
+                self.assertEqual(servers[n].force_connection_close, False)
+            if n == 1:
+                self.assertEqual(servers[n].port, 8081)
+                self.assertEqual(servers[n].force_connection_close, True)
+            if n == 2:
+                self.assertEqual(servers[n].port, 8021)
+            if n == 3:
+                self.assertEqual(servers[n].resource, '/foo/bar/fcgi.soc')
+        self.assertEqual(conf.automatically_quote_dtml_request_data, True)
+        self.assertEqual(conf.skip_authentication_checking, True)
+        self.assertEqual(conf.skip_ownership_checking, True)
+        self.assertEqual(conf.maximum_number_of_session_objects, 1000)
+        self.assertEqual(conf.session_add_notify_script_path, '/flab')
+        self.assertEqual(conf.session_delete_notify_script_path, '/flab')
+        self.assertEqual(conf.session_timeout_minutes, 20)
+        self.assertEqual(conf.suppress_all_access_rules, True)
+        self.assertEqual(conf.suppress_all_site_roots, True)
+        self.assertEqual(conf.database_quota_size, 100)
+        self.assertEqual(conf.read_only_database, False)
+        self.assertEqual(conf.zeo_client_name, 'chris')
+        databases = conf.databases
+        for n in range(len(databases)):
+            if n == 0:
+                self.assertEqual(databases[n].mount_point, '/')
+                self.assertEqual(databases[n].storages[0].file_name, 'foo/bar')
+            if n == 1:
+                self.assertEqual(databases[n].mount_point, '/mount')
+                self.assertEqual(databases[n].storages[0].file_name, 'foo/baz')
+                self.assertEqual(databases[n].storages[1].file_name, 'bar/baz')
+            self.assertEqual(databases[n].db_class, 'ZODB.DB')
+            self.assertEqual(databases[n].cache_size, 5000)
+            self.assertEqual(databases[n].pool_size, 7)
+            self.assertEqual(databases[n].cache_deactivate_after, 60)
+            self.assertEqual(databases[n].version_pool_size, 3)
+            self.assertEqual(databases[n].version_cache_size, 100)
+            self.assertEqual(databases[n].version_cache_deactivate_after, 10)
 
 def test_suite():
     return unittest.makeSuite(ZopeSchemaTestCase)