[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/Traversing/tests - testPresentation.py:1.1.2.1.4.1

Jim Fulton jim@zope.com
Wed, 29 May 2002 11:10:18 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/App/Traversing/tests
In directory cvs.zope.org:/tmp/cvs-serv12181/lib/python/Zope/App/Traversing/tests

Modified Files:
      Tag: Zope3InWonderland-branch
	testPresentation.py 
Log Message:
- Added permission_id attribute to adapter and utility directives.

- Got rid of old getView, getResource, and getDefaultViewName.
  Renamed getRequestView to getView (and so on).

  Changed view interface to use context, rather than getContext.

  Introduced notion of presentation types (e.g. IBrowserPresentation, 
  which is cleaner than IBrowserPublisher).

- Began converting to get/queryFoo, which is much nicer.

- Many formatting fixups.



=== Zope3/lib/python/Zope/App/Traversing/tests/testPresentation.py 1.1.2.1 => 1.1.2.1.4.1 ===
 
 class Content: __implements__ = IContent
-class Resource: __implements__ = IPresentationType
+
+class Resource:
+
+    def __init__(self, request): pass
+    __implements__ = IPresentationType
+
 class View:
     __implements__ = IPresentationType
     
-    def __init__(self, content):
+    def __init__(self, content, request):
         self.content = content
 
 class Request:
 
-    def getViewType(self): return IPresentationType
-    def getViewSkin(self): return ''
+    def getPresentationType(self): return IPresentationType
+    def getPresentationSkin(self): return ''
     
 
 class Test(PlacelessSetup, TestCase):
 
     def testView(self):
-        provideView(IContent, 'foo', IPresentationType, View)
+        provideView(IContent, 'foo', IPresentationType, [View])
 
         ob = Content()
         v = view('foo', (), 'foo;view', ob, Request())
         self.assertEqual(v.__class__, View)
 
     def testResource(self):
-        r = Resource()
-        provideResource('foo', IPresentationType, r)
+        provideResource('foo', IPresentationType, Resource)
 
         ob = Content()
-        rr = resource('foo', (), 'foo;resource', ob, Request())
-        self.assertEqual(rr, r)
+        r = resource('foo', (), 'foo;resource', ob, Request())
+        self.assertEqual(r.__class__, Resource)
         
 
 def test_suite():