[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/ZopePublication/AbsoluteURL/tests - testAbsoluteURL.py:1.1.2.6

Jim Fulton jim@zope.com
Fri, 7 Jun 2002 10:41:51 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/App/ZopePublication/AbsoluteURL/tests
In directory cvs.zope.org:/tmp/cvs-serv12187/lib/python/Zope/App/ZopePublication/AbsoluteURL/tests

Modified Files:
      Tag: Zope-3x-branch
	testAbsoluteURL.py 
Log Message:
Merging in Zope3InWonderland-branch, which implemented the following
proposals (see
http://dev.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/OldProposals): 
- RenameAllowToRequire

- GroupClassRelatedDirectivesInClassDirective

- ViewInterfaceAndSimplification

- ConsistentUseOfSpacesAsDelimitersInZCMLAttributes

- TwoArgumentViewConstructors

- ImplementsInZCML

- SimpleViewCreationInZCML

- RemoveGetView

- ReplaceProtectWithAllow

- ViewMethodsAsViews

- MergeProtectionAndComponentDefinitions

There were also various security fixes resulting of better integration
of security with components.


=== Zope3/lib/python/Zope/App/ZopePublication/AbsoluteURL/tests/testAbsoluteURL.py 1.1.2.5 => 1.1.2.6 ===
 from Zope.ComponentArchitecture.tests.PlacelessSetup import PlacelessSetup
 
-from Zope.ComponentArchitecture import getService, getRequestView
-from Zope.Publisher.Browser.IBrowserPublisher import IBrowserPublisher
+from Zope.ComponentArchitecture import getService, getView
+from Zope.Publisher.Browser.IBrowserPresentation import IBrowserPresentation
 from Zope.Publisher.HTTP.tests.TestRequest import TestRequest
 from Zope.Proxy.ContextWrapper import ContextWrapper
 from Interface import Interface
@@ -30,6 +30,9 @@
 
 class Root:
     __implements__ = IRoot
+    
+class TrivialContent(object):
+    """Trivial content object, used because instances of object are rocks."""
 
 class Test(PlacelessSetup, TestCase):
 
@@ -38,29 +41,31 @@
         from Zope.App.ZopePublication.AbsoluteURL.AbsoluteURL \
              import AbsoluteURL, SiteAbsoluteURL
         provideView=getService(None,"Views").provideView
-        provideView(None, 'absolute_url', IBrowserPublisher, AbsoluteURL)
-        provideView(IRoot, 'absolute_url', IBrowserPublisher, SiteAbsoluteURL)
+        provideView(None, 'absolute_url', IBrowserPresentation,
+                    [AbsoluteURL])
+        provideView(IRoot, 'absolute_url', IBrowserPresentation,
+                    [SiteAbsoluteURL])
 
     def testBadObject(self):
         request = TestRequest()
-        request.setViewType(IBrowserPublisher)
-        view = getRequestView(None, 'absolute_url', request)
+        request.setViewType(IBrowserPresentation)
+        view = getView(None, 'absolute_url', request)
         self.assertRaises(TypeError, view.__str__)
         
     def testNoContext(self):
         request = TestRequest()
-        request.setViewType(IBrowserPublisher)
-        view = getRequestView(Root(), 'absolute_url', request)
+        request.setViewType(IBrowserPresentation)
+        view = getView(Root(), 'absolute_url', request)
         self.assertEqual(str(view), 'http://foobar.com')
         
     def testBasicContext(self):
         request = TestRequest()
-        request.setViewType(IBrowserPublisher)
+        request.setViewType(IBrowserPresentation)
 
-        content = ContextWrapper(object(), Root(), name='a')
-        content = ContextWrapper(object(), content, name='b')
-        content = ContextWrapper(object(), content, name='c')
-        view = getRequestView(content, 'absolute_url', request)
+        content = ContextWrapper(TrivialContent(), Root(), name='a')
+        content = ContextWrapper(TrivialContent(), content, name='b')
+        content = ContextWrapper(TrivialContent(), content, name='c')
+        view = getView(content, 'absolute_url', request)
         self.assertEqual(str(view), 'http://foobar.com/a/b/c')
 
 def test_suite():