[Zope-Checkins]
SVN: Zope/trunk/lib/python/ZServer/tests/test_config.py
added test for http://www.zope.org/Collectors/Zope/1507
(Entry #17, 2.) alias http://www.zope.org/Collectors/Zope/1728
Yvo Schubbe
y.2005- at wcm-solutions.de
Mon May 9 03:34:41 EDT 2005
Log message for revision 30302:
added test for http://www.zope.org/Collectors/Zope/1507 (Entry #17, 2.) alias http://www.zope.org/Collectors/Zope/1728
now 3 tests are failing on Windows
Changed:
U Zope/trunk/lib/python/ZServer/tests/test_config.py
-=-
Modified: Zope/trunk/lib/python/ZServer/tests/test_config.py
===================================================================
--- Zope/trunk/lib/python/ZServer/tests/test_config.py 2005-05-08 21:44:39 UTC (rev 30301)
+++ Zope/trunk/lib/python/ZServer/tests/test_config.py 2005-05-09 07:34:40 UTC (rev 30302)
@@ -27,11 +27,7 @@
# For address kinds of values that don't specify a hostname, ZConfig
# supplies a platform-dependent default.
-import sys
-DEFAULT_HOSTNAME = ''
-if sys.platform in ['win32',]:
- DEFAULT_HOSTNAME = 'localhost'
-del sys
+DEFAULT_HOSTNAME = ZConfig.datatypes.DEFAULT_HOST
class BaseTest(unittest.TestCase):
schema = None
@@ -56,14 +52,14 @@
self.assertEqual(len(conf.servers), 1)
return conf.servers[0]
- def check_prepare(self, factory):
+ def check_prepare(self, factory, defaulthost='127.0.0.1'):
# On Linux the default hostname is an empty string, but on Windows
# it's "localhost". So factory.prepare() will replace factory.host
# with "127.0.0.1" only on non-Windows boxes.
- expected_factory_host = factory.host or "127.0.0.1"
+ expected_factory_host = factory.host or defaulthost
port = factory.port
o = object()
- factory.prepare("127.0.0.1", o, "module",
+ factory.prepare(defaulthost, o, "module",
{"key": "value"}, portbase=9300)
self.assert_(factory.dnsresolver is o)
self.assertEqual(factory.module, "module")
@@ -111,6 +107,22 @@
self.assertEqual(server.port, 9381)
server.close()
+ def test_http_factory_defaulthost(self):
+ factory = self.load_factory("""\
+ <http-server>
+ address 81
+ force-connection-close true
+ webdav-source-clients cadaever
+ </http-server>
+ """)
+ self.check_prepare(factory, defaulthost='0.0.0.0')
+ server = factory.create()
+ self.assertEqual(server.ip, '0.0.0.0',
+ 'Zope Collector issue #1507/1728 (ignoring '
+ 'defaulthost): %r != \'0.0.0.0\'' % server.ip)
+ self.assertEqual(server.port, 9381)
+ server.close()
+
def test_webdav_source_factory(self):
factory = self.load_factory("""\
<webdav-source-server>
More information about the Zope-Checkins
mailing list