[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/ZMI/tests - testZMIViewUtility.py:1.1.2.1
Jim Fulton
jim@zope.com
Thu, 31 Jan 2002 19:31:47 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/ZMI/tests
In directory cvs.zope.org:/tmp/cvs-serv21391/tests
Added Files:
Tag: Zope-3x-branch
testZMIViewUtility.py
Log Message:
Added utility view for getting ZMI tab data
=== Added File Zope3/lib/python/Zope/App/ZMI/tests/testZMIViewUtility.py ===
#############################################################################
#
# Copyright (c) 2001 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
#
##############################################################################
import unittest, sys
from Interface import Interface
from Zope.App.ZMI.IZMIViewService import IZMIViewService
from Zope.ComponentArchitecture import getService, provideService, _clear
from Zope.App.ZMI.ZMIViewUtility import ZMIViewUtility
class Service:
__implements__ = IZMIViewService
def getViews(ob):
return [('l1', 'a1'), ('l2', 'a2'), ('l3', 'a3'),]
class Test(unittest.TestCase):
def setUp(self):
defineService('ZMIViewService', IZMIViewService)
provideService('ZMIViewService', Service)
def tearDown(self):
_clear()
def test(self):
v = ZMIViewUtility(None)
self.assertEqual(v.views(),
{'l1': 'a1', 'l2': 'a2', 'l3': 'a3'})
def test_suite():
loader=unittest.TestLoader()
return loader.loadTestsFromTestCase(Test)
if __name__=='__main__':
unittest.TextTestRunner().run(test_suite())