[Zope3-checkins] CVS: Zope3/src/zope/app/publisher/browser/tests - test_fileresource.py:1.8 test_pagetemplateresource.py:1.2 test_resources.py:1.6 testi18nfileresource.py:1.6

Jim Fulton cvs-admin at zope.org
Fri Nov 21 12:12:41 EST 2003


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

Modified Files:
	test_fileresource.py test_pagetemplateresource.py 
	test_resources.py testi18nfileresource.py 
Log Message:
Changed to use the new ztapi module, which provides handy functions
for setting up adapters and views for tests.  This is needed because
there are no-longer global adapter and view services sitting around as
module globals.


=== Zope3/src/zope/app/publisher/browser/tests/test_fileresource.py 1.7 => 1.8 ===
--- Zope3/src/zope/app/publisher/browser/tests/test_fileresource.py:1.7	Mon Aug 11 10:58:13 2003
+++ Zope3/src/zope/app/publisher/browser/tests/test_fileresource.py	Fri Nov 21 12:12:10 2003
@@ -26,7 +26,7 @@
 from zope.exceptions import NotFoundError
 
 from zope.app.tests.placelesssetup import PlacelessSetup
-from zope.component.adapter import provideAdapter
+from zope.app.tests import ztapi
 from zope.proxy import removeAllProxies
 
 from zope.i18n.interfaces import IUserPreferredCharsets
@@ -49,7 +49,8 @@
 
     def setUp(self):
         PlacelessSetup.setUp(self)
-        provideAdapter(IHTTPRequest, IUserPreferredCharsets, HTTPCharsets)
+        ztapi.provideAdapter(IHTTPRequest, IUserPreferredCharsets,
+                             HTTPCharsets)
 
     def testNoTraversal(self):
 


=== Zope3/src/zope/app/publisher/browser/tests/test_pagetemplateresource.py 1.1 => 1.2 ===
--- Zope3/src/zope/app/publisher/browser/tests/test_pagetemplateresource.py:1.1	Mon Aug 11 10:58:13 2003
+++ Zope3/src/zope/app/publisher/browser/tests/test_pagetemplateresource.py	Fri Nov 21 12:12:10 2003
@@ -19,7 +19,7 @@
 from unittest import TestCase, main, makeSuite
 
 from zope.exceptions import NotFoundError
-from zope.component.adapter import provideAdapter
+from zope.app.tests import ztapi
 from zope.security.checker import NamesChecker
 from zope.publisher.browser import TestRequest
 
@@ -40,7 +40,7 @@
 
     def setUp(self):
         PlacelessSetup.setUp(self)
-        provideAdapter(None, ITraversable, DefaultTraversable)
+        ztapi.provideAdapter(None, ITraversable, DefaultTraversable)
 
     def testNoTraversal(self):
         path = os.path.join(test_directory, 'testfiles', 'test.pt')


=== Zope3/src/zope/app/publisher/browser/tests/test_resources.py 1.5 => 1.6 ===
--- 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	Fri Nov 21 12:12:10 2003
@@ -18,10 +18,9 @@
 """
 
 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.app.tests import ztapi
 
 from zope.i18n.interfaces import IUserPreferredCharsets
 
@@ -34,7 +33,8 @@
 
     def setUp(self):
         PlacelessSetup.setUp(self)
-        provideAdapter(IHTTPRequest, IUserPreferredCharsets, HTTPCharsets)
+        ztapi.provideAdapter(IHTTPRequest, IUserPreferredCharsets,
+                             HTTPCharsets)
 
     def test_publishTraverse(self):
         from zope.app.publisher.browser.resources import Resources
@@ -44,7 +44,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 +57,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)


=== Zope3/src/zope/app/publisher/browser/tests/testi18nfileresource.py 1.5 => 1.6 ===
--- Zope3/src/zope/app/publisher/browser/tests/testi18nfileresource.py:1.5	Mon Aug 11 10:58:13 2003
+++ Zope3/src/zope/app/publisher/browser/tests/testi18nfileresource.py	Fri Nov 21 12:12:10 2003
@@ -24,7 +24,7 @@
 from zope.exceptions import NotFoundError
 
 from zope.app.tests.placelesssetup import PlacelessSetup
-from zope.component.adapter import provideAdapter
+from zope.app.tests import ztapi
 
 from zope.i18n.interfaces import IUserPreferredCharsets
 from zope.i18n.interfaces import IUserPreferredLanguages
@@ -54,8 +54,10 @@
     def setUp(self):
         PlacelessSetup.setUp(self)
         TestII18nAware.setUp(self)
-        provideAdapter(IHTTPRequest, IUserPreferredCharsets, HTTPCharsets)
-        provideAdapter(IHTTPRequest, IUserPreferredLanguages, BrowserLanguages)
+        ztapi.provideAdapter(IHTTPRequest, IUserPreferredCharsets,
+                             HTTPCharsets)
+        ztapi.provideAdapter(IHTTPRequest, IUserPreferredLanguages,
+                             BrowserLanguages)
         # Setup the negotiator service registry entry
         managerHandler('defineService', 'LanguageNegotiation', INegotiator)
         provideService('LanguageNegotiation', negotiator, 'zope.Public')




More information about the Zope3-Checkins mailing list