[Zope3-checkins] CVS: Zope3/src/zope/app/browser/applicationcontrol/tests - __init__.py:1.2 test_runtimeinfoview.py:1.2 test_servercontrolview.py:1.2
Jim Fulton
jim@zope.com
Wed, 25 Dec 2002 09:13:58 -0500
Update of /cvs-repository/Zope3/src/zope/app/browser/applicationcontrol/tests
In directory cvs.zope.org:/tmp/cvs-serv15352/src/zope/app/browser/applicationcontrol/tests
Added Files:
__init__.py test_runtimeinfoview.py test_servercontrolview.py
Log Message:
Grand renaming:
- Renamed most files (especially python modules) to lower case.
- Moved views and interfaces into separate hierarchies within each
project, where each top-level directory under the zope package
is a separate project.
- Moved everything to src from lib/python.
lib/python will eventually go away. I need access to the cvs
repository to make this happen, however.
There are probably some bits that are broken. All tests pass
and zope runs, but I haven't tried everything. There are a number
of cleanups I'll work on tomorrow.
=== Zope3/src/zope/app/browser/applicationcontrol/tests/__init__.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:13:58 2002
+++ Zope3/src/zope/app/browser/applicationcontrol/tests/__init__.py Wed Dec 25 09:12:27 2002
@@ -0,0 +1,2 @@
+#
+# This file is necessary to make this directory a package.
=== Zope3/src/zope/app/browser/applicationcontrol/tests/test_runtimeinfoview.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:13:58 2002
+++ Zope3/src/zope/app/browser/applicationcontrol/tests/test_runtimeinfoview.py Wed Dec 25 09:12:27 2002
@@ -0,0 +1,55 @@
+##############################################################################
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+
+from unittest import TestCase, TestSuite, main, makeSuite
+
+from zope.app.applicationcontrol.applicationcontrol import \
+ applicationController
+from zope.app.interfaces.applicationcontrol.applicationcontrol import \
+ IApplicationControl
+from zope.app.interfaces.applicationcontrol.runtimeinfo import IRuntimeInfo
+from zope.app.applicationcontrol.runtimeinfo import RuntimeInfo
+from zope.app.browser.applicationcontrol.runtimeinfo \
+ import RuntimeInfoView
+from zope.component import getService
+from types import DictType
+from zope.app.services.tests.placefulsetup\
+ import PlacefulSetup
+
+class Test(PlacefulSetup, TestCase):
+
+ def _TestView__newView(self, container):
+ return RuntimeInfoView(container, None)
+
+ def test_RuntimeInfoView(self):
+ getService(None,'Adapters').provideAdapter(
+ IApplicationControl, IRuntimeInfo, RuntimeInfo)
+ test_runtimeinfoview = self._TestView__newView(applicationController)
+
+ test_format = test_runtimeinfoview.runtimeInfo()
+ self.failUnless(isinstance(test_format, DictType))
+
+ assert_keys = ['ZopeVersion', 'PythonVersion', 'PythonPath',
+ 'SystemPlatform', 'CommandLine', 'ProcessId', 'Uptime' ]
+ test_keys = test_format.keys()
+
+ assert_keys.sort()
+ test_keys.sort()
+ self.failUnless(assert_keys == test_keys)
+
+def test_suite():
+ return makeSuite(Test)
+
+if __name__=='__main__':
+ main(defaultTest='test_suite')
=== Zope3/src/zope/app/browser/applicationcontrol/tests/test_servercontrolview.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:13:58 2002
+++ Zope3/src/zope/app/browser/applicationcontrol/tests/test_servercontrolview.py Wed Dec 25 09:12:27 2002
@@ -0,0 +1,53 @@
+##############################################################################
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+
+from unittest import TestCase, TestSuite, main, makeSuite
+
+from zope.app.applicationcontrol.applicationcontrol import \
+ applicationController
+from zope.app.interfaces.applicationcontrol.servercontrol import \
+ IServerControl
+from zope.app.browser.applicationcontrol.servercontrol import ServerControlView
+from zope.app.applicationcontrol.servercontrol import \
+ ServerControl
+from zope.component import getService
+from zope.app.services.tests.placefulsetup\
+ import PlacefulSetup
+
+class Test(PlacefulSetup, TestCase):
+
+ def _TestView__newView(self, container, request):
+ return ServerControlView(container, request)
+
+ def test_ServerControlView(self):
+ getService(None,"Utilities").provideUtility(
+ IServerControl, ServerControl())
+
+ test_serverctrl = self._TestView__newView(
+ applicationController,
+ {'shutdown': 1},
+ )
+ test_serverctrl.action()
+
+ test_serverctrl = self._TestView__newView(
+ applicationController,
+ {'restart': 1},
+ )
+ test_serverctrl.action()
+
+def test_suite():
+ return makeSuite(Test)
+
+if __name__=='__main__':
+ main(defaultTest='test_suite')