[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/OFS/ApplicationControl/ServerControl/Views/Browser/tests - __init__.py:1.1.2.1 testServerControlView.py:1.1.2.1

Philipp von Weitershausen philikon@gmx.net
Wed, 10 Apr 2002 10:41:57 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/ApplicationControl/ServerControl/Views/Browser/tests
In directory cvs.zope.org:/tmp/cvs-serv2399/ServerControl/Views/Browser/tests

Added Files:
      Tag: Zope-3x-branch
	__init__.py testServerControlView.py 
Log Message:
Added a plugin for ApplicationControl for shutting down and restarting the
server. There is no implementation available yet, though.


=== Added File Zope3/lib/python/Zope/App/OFS/ApplicationControl/ServerControl/Views/Browser/tests/__init__.py ===



=== Added File Zope3/lib/python/Zope/App/OFS/ApplicationControl/ServerControl/Views/Browser/tests/testServerControlView.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.OFS.ApplicationControl.ApplicationControl import ApplicationController
from Zope.App.OFS.ApplicationControl.ServerControl.IServerControl import IServerControl
from Zope.App.OFS.ApplicationControl.ServerControl.Views.Browser.ServerControlView import ServerControlView
from Zope.App.OFS.ApplicationControl.ServerControl.StubServerControl import StubServerControl
from Zope.ComponentArchitecture import provideUtility

class Test(TestCase):

    def _TestView__newView(self, container):
        return ServerControlView(container)

    def test_ServerControlView(self):
        provideUtility(IServerControl, StubServerControl())
        test_serverctrl = self._TestView__newView(ApplicationController)

        test_shutdown = {'shutdown': 1}
        test_restart = {'restart': 1}

        # Testing shutdown and restart is somewhat tricky ;), we only want to
        # see that the methods return None as we specified that they may not
        # return anything. 

        # XXX May actual 'correct' implementations break this test as it tries
        # to restart zope ???
        self.assertEqual(test_serverctrl.action(REQUEST=test_shutdown), None)
        self.assertEqual(test_serverctrl.action(REQUEST=test_restart), None)
       
def test_suite():
    return TestSuite((
        makeSuite(Test),
        ))

if __name__=='__main__':
    main(defaultTest='test_suite')