[Zope3-checkins] CVS: Zope3/src/zope/app/services/tests - test_viewpackage.py:1.4
Jim Fulton
jim@zope.com
Fri, 7 Feb 2003 10:09:54 -0500
Update of /cvs-repository/Zope3/src/zope/app/services/tests
In directory cvs.zope.org:/tmp/cvs-serv9561/src/zope/app/services/tests
Modified Files:
test_viewpackage.py
Log Message:
view packages were broken by the addition of the 'attribute' field in
page configurations. This was because the page configuration
contstructor changed in a non-backward-compatible way. This wasn't
caught be the test for adding templates to page folders.
- Fixed the test
- Changed view package setObject to use keyword arguments when
creating a page config.
- provided a default value for the attribute field in the page config
class.
=== Zope3/src/zope/app/services/tests/test_viewpackage.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/services/tests/test_viewpackage.py:1.3 Mon Feb 3 12:29:11 2003
+++ Zope3/src/zope/app/services/tests/test_viewpackage.py Fri Feb 7 10:09:53 2003
@@ -17,17 +17,18 @@
"""
from unittest import TestCase, TestSuite, main, makeSuite
-from zope.app.services.tests.placefulsetup \
- import PlacefulSetup
+from zope.app.services.tests.placefulsetup import PlacefulSetup
from zope.app.services.viewpackage import ViewPackage
from zope.app.traversing import traverse
from zope.app.services.zpt import ZPTTemplate
from zope.app.services.view import ViewService
from zope.app.interfaces.services.configuration import Active
from zope.app.services.service import ServiceManager
-from zope.app.services.service \
- import ServiceConfiguration
+from zope.app.services.service import ServiceConfiguration
from zope.interface import Interface
+from zope.publisher.interfaces.browser import IBrowserPresentation
+
+class I(Interface): pass
class Test(PlacefulSetup, TestCase):
@@ -37,9 +38,9 @@
default = traverse(self.rootFolder, '++etc++Services/Packages/default')
default.setObject('Views', ViewPackage())
views = traverse(default, 'Views')
- views.forInterface = Interface
+ views.forInterface = I
views.factoryName = None
- views.permission = None
+ views.permission = 'zope.View'
#set up view service
default.setObject('ViewService', ViewService())
@@ -55,6 +56,13 @@
configuration = traverse(views, 'configure/1')
self.assertEqual(configuration.status, Active)
+ self.assertEqual(configuration.forInterface, I)
+ self.assertEqual(configuration.presentationType, IBrowserPresentation)
+ self.assertEqual(configuration.viewName, u'foo.html')
+ self.assertEqual(configuration.layer, 'default')
+ self.assertEqual(configuration.class_, None)
+ self.assertEqual(configuration.permission, 'zope.View')
+ self.assertEqual(configuration.attribute, None)
self.assertRaises(TypeError,
views.setObject, 'bar.html', ViewPackage())