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

Philipp von Weitershausen philikon@gmx.net
Wed, 10 Apr 2002 05:15:18 -0400


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

Added Files:
      Tag: Zope-3x-branch
	__init__.py testRuntimeInfoView.py 
Log Message:
Added default view for ApplicationController showing runtime information,
accessible through /ApplicationController;etc


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



=== Added File Zope3/lib/python/Zope/App/OFS/ApplicationControl/Views/Browser/tests/testRuntimeInfoView.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.IApplicationControl import IApplicationControl
from Zope.App.OFS.ApplicationControl.IRuntimeInfo import IRuntimeInfo
from Zope.App.OFS.ApplicationControl.RuntimeInfo import RuntimeInfo
from Zope.App.OFS.ApplicationControl.Views.Browser.RuntimeInfoView import RuntimeInfoView
from Zope.ComponentArchitecture import provideAdapter
from types import DictType

class Test(TestCase):

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

    def test_RuntimeInfoView(self):
        provideAdapter(IApplicationControl, IRuntimeInfo, RuntimeInfo)
        test_runtimeinfoview = self._TestView__newView(ApplicationController)
        test_format = test_runtimeinfoview.runtimeInfo()
        self.assertEquals(type(test_format), DictType)
        assert_keys = ['ZopeVersion', 'PythonVersion', 'PythonPath', 'SystemPlatform', 'CommandLine', 'ProcessId', 'Uptime' ]
        test_keys = test_format.keys()
        self.failUnless(min([key in assert_keys for key in test_keys]))

def test_suite():
    return TestSuite((
        makeSuite(Test),
        ))

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