[Zope3-checkins] CVS: Zope3/src/zope/app/publisher/browser/tests - test_directives.py:1.24.6.1 test_icondirective.py:1.13.6.1 test_resources.py:1.5.42.1

Jim Fulton cvs-admin at zope.org
Sun Nov 9 11:08:55 EST 2003


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

Modified Files:
      Tag: adaptergeddon-branch
	test_directives.py test_icondirective.py test_resources.py 
Log Message:
Created a global presentation service that replaces the 
global view, resource, and skin services.

Now look up presentation components by adapting from a request type,
rather than adapting to a presentation type.





=== Zope3/src/zope/app/publisher/browser/tests/test_directives.py 1.24 => 1.24.6.1 ===
--- Zope3/src/zope/app/publisher/browser/tests/test_directives.py:1.24	Mon Sep 22 18:37:26 2003
+++ Zope3/src/zope/app/publisher/browser/tests/test_directives.py	Sun Nov  9 11:08:24 2003
@@ -30,11 +30,8 @@
 
 from zope.app.publisher.browser.globalbrowsermenuservice import \
     globalBrowserMenuService
-from zope.component.tests.request import Request
 from zope.publisher.browser import TestRequest
 
-from zope.publisher.interfaces.browser import IBrowserPresentation
-
 from zope.app.publisher.browser.i18nfileresource import I18nFileResource
 
 import zope.app.publisher.browser
@@ -59,7 +56,8 @@
    %s
    </configure>"""
 
-request = Request(IBrowserPresentation)
+
+request = TestRequest()
 
 class VT(V1, object):
     def publishTraverse(self, request, name):
@@ -142,7 +140,8 @@
             """ % testusage
             )))
 
-        menuItem = globalBrowserMenuService.getFirstMenuItem('test_menu', ob, TestRequest())
+        menuItem = globalBrowserMenuService.getFirstMenuItem(
+            'test_menu', ob, TestRequest())
         self.assertEqual(menuItem["title"], "Test View")
         self.assertEqual(menuItem["action"], "@@test")
         v = queryView(ob, 'test', request)
@@ -190,7 +189,8 @@
             """ % testusage
             )))
 
-        menuItem = globalBrowserMenuService.getFirstMenuItem('test_menu', ob, TestRequest())
+        menuItem = globalBrowserMenuService.getFirstMenuItem(
+            'test_menu', ob, TestRequest())
         self.assertEqual(menuItem["title"], "Test View")
         self.assertEqual(menuItem["action"], "@@test")
         v = queryView(ob, 'test', request)
@@ -215,7 +215,8 @@
             """ % testusage
             )))
 
-        menuItem = globalBrowserMenuService.getFirstMenuItem('test_menu', ob, TestRequest())
+        menuItem = globalBrowserMenuService.getFirstMenuItem(
+            'test_menu', ob, TestRequest())
         self.assertEqual(menuItem["title"], "Test View")
         self.assertEqual(menuItem["action"], "@@test")
         v = queryView(ob, 'test', request)
@@ -261,7 +262,8 @@
             """ % testusage
             )))
 
-        menuItem = globalBrowserMenuService.getFirstMenuItem('test_menu', ob, TestRequest())
+        menuItem = globalBrowserMenuService.getFirstMenuItem(
+            'test_menu', ob, TestRequest())
         self.assertEqual(menuItem["title"], "Test View")
         self.assertEqual(menuItem["action"], "@@test")
         v = queryView(ob, 'test', request)
@@ -287,7 +289,8 @@
             """ % testusage
             )))
 
-        menuItem = globalBrowserMenuService.getFirstMenuItem('test_menu', ob, TestRequest())
+        menuItem = globalBrowserMenuService.getFirstMenuItem(
+            'test_menu', ob, TestRequest())
         self.assertEqual(menuItem["title"], "Test View")
         self.assertEqual(menuItem["action"], "@@test")
         v = queryView(ob, 'test', request)
@@ -314,7 +317,8 @@
             """ % testusage
             )))
 
-        menuItem = globalBrowserMenuService.getFirstMenuItem('test_menu', ob, TestRequest())
+        menuItem = globalBrowserMenuService.getFirstMenuItem(
+            'test_menu', ob, TestRequest())
         self.assertEqual(menuItem["title"], "Test View")
         self.assertEqual(menuItem["action"], "@@test")
         v = queryView(ob, 'test', request)
@@ -341,6 +345,7 @@
 
         xmlconfig(StringIO(template % (
             """
+            <browser:layer name="zmi" />
             <browser:skin name="zmi" layers="zmi default" />
             <browser:page name="test"
                   class="zope.component.tests.views.VZMI"
@@ -360,7 +365,7 @@
 
         v = queryView(ob, 'test', request)
         self.assert_(issubclass(v.__class__, V1))
-        v = queryView(ob, 'test', Request(IBrowserPresentation, 'zmi'))
+        v = queryView(ob, 'test', TestRequest(skin='zmi'))
         self.assert_(issubclass(v.__class__, VZMI))
 
     def testI18nResource(self):
@@ -763,6 +768,7 @@
 
         xmlconfig(StringIO(template %
             """
+            <browser:layer name="layer" />
             <browser:skin name="skinny" layers="layer default" />
             <browser:pages
                   for="*"
@@ -786,8 +792,7 @@
 
         v = getView(ob, 'index.html', request)
         self.assertEqual(v(), 'V1 here')
-        v = getView(ob, 'index.html',
-                    Request(IBrowserPresentation, "skinny"))
+        v = getView(ob, 'index.html', TestRequest(skin="skinny"))
         self.assertEqual(v(), 'done')
 
     def testFile(self):
@@ -826,6 +831,7 @@
 
         xmlconfig(StringIO(template % (
             """
+            <browser:layer name="zmi" />
             <browser:skin name="zmi" layers="zmi default" />
             <browser:resource name="test" file="%s" 
                   layer="zmi" />
@@ -834,7 +840,7 @@
 
         self.assertEqual(queryResource(ob, 'test', request), None)
 
-        r = getResource(ob, 'test', Request(IBrowserPresentation, 'zmi'))
+        r = getResource(ob, 'test', TestRequest(skin='zmi'))
         r = removeAllProxies(r)
         self.assertEqual(r._testData(), open(path, 'rb').read())
 


=== Zope3/src/zope/app/publisher/browser/tests/test_icondirective.py 1.13 => 1.13.6.1 ===
--- Zope3/src/zope/app/publisher/browser/tests/test_icondirective.py:1.13	Wed Sep 24 13:22:07 2003
+++ Zope3/src/zope/app/publisher/browser/tests/test_icondirective.py	Sun Nov  9 11:08:24 2003
@@ -26,7 +26,6 @@
 from zope.configuration.xmlconfig import xmlconfig, XMLConfig
 from zope.publisher.browser import TestRequest
 from zope.component.tests.views import IC
-from zope.publisher.interfaces.browser import IBrowserPresentation
 from zope.component import queryView, getView, getResource
 from zope.configuration.exceptions import ConfigurationError
 from zope.interface import implements
@@ -45,7 +44,7 @@
    </configure>"""
 
 
-request = TestRequest(IBrowserPresentation)
+request = TestRequest()
 
 class Ob:
     implements(IC, ISite, IContainmentRoot)


=== Zope3/src/zope/app/publisher/browser/tests/test_resources.py 1.5 => 1.5.42.1 ===
--- Zope3/src/zope/app/publisher/browser/tests/test_resources.py:1.5	Thu May  1 15:35:28 2003
+++ Zope3/src/zope/app/publisher/browser/tests/test_resources.py	Sun Nov  9 11:08:24 2003
@@ -18,9 +18,8 @@
 """
 
 from unittest import TestCase, main, makeSuite
-
+from zope.app.tests import ztapi
 from zope.app.tests.placelesssetup import PlacelessSetup
-from zope.component.resource import provideResource
 from zope.component.adapter import provideAdapter
 
 from zope.i18n.interfaces import IUserPreferredCharsets
@@ -44,7 +43,7 @@
             def __init__(self, request): pass
             def __call__(self): return 42
 
-        provideResource('test', IBrowserView, Resource)
+        ztapi.browserResource('test', Resource)
         view = Resources(None, request)
         resource = view.publishTraverse(request, 'test')
         self.assertEqual(resource(), 42)
@@ -57,7 +56,7 @@
             def __init__(self, request): pass
             def __call__(self): return 42
 
-        provideResource('test', IBrowserView, Resource)
+        ztapi.browserResource('test', Resource)
         view = Resources(None, request)
         resource = view['test']
         self.assertEqual(resource(), 42)




More information about the Zope3-Checkins mailing list