[Zope3-checkins] CVS: Zope3/src/zope/app/publisher/browser/tests - test_resources.py:1.4

Jim Fulton jim@zope.com
Sat, 25 Jan 2003 08:19:30 -0500


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

Modified Files:
	test_resources.py 
Log Message:
Added a __getitem__ method to the resources view (aka @@) so that it
can be used in zpt paths as will as in URLs. 


=== Zope3/src/zope/app/publisher/browser/tests/test_resources.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/publisher/browser/tests/test_resources.py:1.3	Mon Dec 30 21:52:03 2002
+++ Zope3/src/zope/app/publisher/browser/tests/test_resources.py	Sat Jan 25 08:19:27 2003
@@ -36,8 +36,7 @@
         PlacelessSetup.setUp(self)
         provideAdapter(IHTTPRequest, IUserPreferredCharsets, HTTPCharsets)
 
-
-    def test(self):
+    def test_publishTraverse(self):
         from zope.app.publisher.browser.resources import Resources
         request = TestRequest()
 
@@ -48,6 +47,19 @@
         provideResource('test', IBrowserView, Resource)
         view = Resources(None, request)
         resource = view.publishTraverse(request, 'test')
+        self.assertEqual(resource(), 42)
+
+    def test_getitem(self):
+        from zope.app.publisher.browser.resources import Resources
+        request = TestRequest()
+
+        class Resource:
+            def __init__(self, request): pass
+            def __call__(self): return 42
+
+        provideResource('test', IBrowserView, Resource)
+        view = Resources(None, request)
+        resource = view['test']
         self.assertEqual(resource(), 42)
 
     def testNotFound(self):