[Zope3-checkins] CVS: Zope3/src/zope/app/browser/applicationcontrol/tests - __init__.py:1.1.2.1 test_runtimeinfoview.py:1.1.2.1 test_servercontrolview.py:1.1.2.1

Jim Fulton jim@zope.com
Mon, 23 Dec 2002 14:31:00 -0500


Update of /cvs-repository/Zope3/src/zope/app/browser/applicationcontrol/tests
In directory cvs.zope.org:/tmp/cvs-serv19908/zope/app/browser/applicationcontrol/tests

Added Files:
      Tag: NameGeddon-branch
	__init__.py test_runtimeinfoview.py test_servercontrolview.py 
Log Message:
Initial renaming before debugging

=== Added File Zope3/src/zope/app/browser/applicationcontrol/tests/__init__.py ===
#
# This file is necessary to make this directory a package.


=== Added File Zope3/src/zope/app/browser/applicationcontrol/tests/test_runtimeinfoview.py ===
##############################################################################
#
# 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')


=== Added File Zope3/src/zope/app/browser/applicationcontrol/tests/test_servercontrolview.py ===
##############################################################################
#
# 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.OFS.ApplicationControl.ServerControl.Views.Browser.ServerControlView\
  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')