[Zope3-checkins] CVS: Zope3/src/zope/app/traversing/tests -
test_acquire.py:1.9 test_conveniencefunctions.py:1.21
test_physicallocationadapters.py:1.15
test_presentation.py:1.6 test_traverser.py:1.14
Jim Fulton
cvs-admin at zope.org
Fri Nov 21 12:12:47 EST 2003
Update of /cvs-repository/Zope3/src/zope/app/traversing/tests
In directory cvs.zope.org:/tmp/cvs-serv31883/src/zope/app/traversing/tests
Modified Files:
test_acquire.py test_conveniencefunctions.py
test_physicallocationadapters.py test_presentation.py
test_traverser.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/traversing/tests/test_acquire.py 1.8 => 1.9 ===
--- Zope3/src/zope/app/traversing/tests/test_acquire.py:1.8 Sun Sep 21 13:31:14 2003
+++ Zope3/src/zope/app/traversing/tests/test_acquire.py Fri Nov 21 12:12:15 2003
@@ -21,14 +21,14 @@
from zope.app.tests.placelesssetup import PlacelessSetup
from zope.app.interfaces.traversing import ITraversable
from zope.app.traversing.adapters import DefaultTraversable
-from zope.component.adapter import provideAdapter
+from zope.app.tests import ztapi
from zope.app.traversing.namespace import acquire
from zope.exceptions import NotFoundError
class Test(PlacelessSetup, TestCase):
def test(self):
- provideAdapter(None, ITraversable, DefaultTraversable)
+ ztapi.provideAdapter(None, ITraversable, DefaultTraversable)
class C:
def __init__(self, name):
=== Zope3/src/zope/app/traversing/tests/test_conveniencefunctions.py 1.20 => 1.21 ===
--- Zope3/src/zope/app/traversing/tests/test_conveniencefunctions.py:1.20 Sun Sep 21 13:31:14 2003
+++ Zope3/src/zope/app/traversing/tests/test_conveniencefunctions.py Fri Nov 21 12:12:15 2003
@@ -16,6 +16,7 @@
$Id$
"""
from unittest import TestCase, main, makeSuite
+from zope.app.tests import ztapi
from zope.interface import directlyProvides
from zope.app.services.tests.placefulsetup import PlacefulSetup
from zope.app.traversing.adapters import Traverser
@@ -68,13 +69,13 @@
folder.item = item
self.tr = Traverser(root)
- getService(None, Adapters).provideAdapter(
+ ztapi.provideAdapter(
None, ITraverser, Traverser)
- getService(None, Adapters).provideAdapter(
+ ztapi.provideAdapter(
None, ITraversable, DefaultTraversable)
- getService(None, Adapters).provideAdapter(
+ ztapi.provideAdapter(
None, IPhysicallyLocatable, LocationPhysicallyLocatable)
- getService(None, Adapters).provideAdapter(
+ ztapi.provideAdapter(
IContainmentRoot, IPhysicallyLocatable, RootPhysicallyLocatable)
def testTraverse(self):
=== Zope3/src/zope/app/traversing/tests/test_physicallocationadapters.py 1.14 => 1.15 ===
--- Zope3/src/zope/app/traversing/tests/test_physicallocationadapters.py:1.14 Sun Sep 21 13:31:14 2003
+++ Zope3/src/zope/app/traversing/tests/test_physicallocationadapters.py Fri Nov 21 12:12:16 2003
@@ -17,7 +17,7 @@
from unittest import TestCase, main, makeSuite
from zope.app.tests.placelesssetup import PlacelessSetup
-from zope.component.adapter import provideAdapter
+from zope.app.tests import ztapi
from zope.component import getAdapter
from zope.interface import implements
@@ -36,9 +36,10 @@
class Test(PlacelessSetup, TestCase):
def test(self):
- provideAdapter(None, IPhysicallyLocatable, LocationPhysicallyLocatable)
- provideAdapter(IContainmentRoot, IPhysicallyLocatable,
- RootPhysicallyLocatable)
+ ztapi.provideAdapter(None, IPhysicallyLocatable,
+ LocationPhysicallyLocatable)
+ ztapi.provideAdapter(IContainmentRoot, IPhysicallyLocatable,
+ RootPhysicallyLocatable)
root = Root()
f1 = contained(C(), root, name='f1')
=== Zope3/src/zope/app/traversing/tests/test_presentation.py 1.5 => 1.6 ===
--- Zope3/src/zope/app/traversing/tests/test_presentation.py:1.5 Wed Jun 4 04:46:33 2003
+++ Zope3/src/zope/app/traversing/tests/test_presentation.py Fri Nov 21 12:12:16 2003
@@ -18,53 +18,43 @@
"""
from unittest import TestCase, main, makeSuite
+from zope.app.tests import ztapi
from zope.app.tests.placelesssetup import PlacelessSetup
-from zope.component.view import provideView
-from zope.component.resource import provideResource
from zope.app.traversing.namespace import view, resource
from zope.interface import Interface, implements
+from zope.publisher.browser import TestRequest
class IContent(Interface):
pass
-class IPresentationType(Interface):
- pass
-
class Content:
implements(IContent)
class Resource:
- implements(IPresentationType)
def __init__(self, request):
pass
class View:
- implements(IPresentationType)
def __init__(self, content, request):
self.content = content
-class Request:
-
- def getPresentationType(self): return IPresentationType
- def getPresentationSkin(self): return ''
-
class Test(PlacelessSetup, TestCase):
def testView(self):
- provideView(IContent, 'foo', IPresentationType, [View])
+ ztapi.browserView(IContent, 'foo', [View])
ob = Content()
- v = view('foo', (), '@@foo', ob, Request())
+ v = view('foo', (), '@@foo', ob, TestRequest())
self.assertEqual(v.__class__, View)
def testResource(self):
- provideResource('foo', IPresentationType, Resource)
+ ztapi.browserResource('foo', Resource)
ob = Content()
- r = resource('foo', (), '++resource++foo', ob, Request())
+ r = resource('foo', (), '++resource++foo', ob, TestRequest())
self.assertEqual(r.__class__, Resource)
=== Zope3/src/zope/app/traversing/tests/test_traverser.py 1.13 => 1.14 ===
--- Zope3/src/zope/app/traversing/tests/test_traverser.py:1.13 Sun Sep 21 13:31:14 2003
+++ Zope3/src/zope/app/traversing/tests/test_traverser.py Fri Nov 21 12:12:16 2003
@@ -18,6 +18,7 @@
import unittest
+from zope.app.tests import ztapi
from zope.interface import directlyProvides
from zope.interface.verify import verifyClass
from zope.interface import implementedBy
@@ -83,11 +84,11 @@
PlacefulSetup.setUp(self)
# Build up a wrapper chain
- getService(None, Adapters).provideAdapter(
+ ztapi.provideAdapter(
None, ITraversable, DefaultTraversable)
- getService(None, Adapters).provideAdapter(
+ ztapi.provideAdapter(
None, IPhysicallyLocatable, LocationPhysicallyLocatable)
- getService(None, Adapters).provideAdapter(
+ ztapi.provideAdapter(
IContainmentRoot, IPhysicallyLocatable, RootPhysicallyLocatable)
self.root = root = C('root')
@@ -154,11 +155,11 @@
def setUp(self):
PlacefulSetup.setUp(self)
- getService(None,Adapters).provideAdapter(
+ ztapi.provideAdapter(
None, ITraversable, DefaultTraversable)
- getService(None, Adapters).provideAdapter(
+ ztapi.provideAdapter(
None, IPhysicallyLocatable, LocationPhysicallyLocatable)
- getService(None, Adapters).provideAdapter(
+ ztapi.provideAdapter(
IContainmentRoot, IPhysicallyLocatable, RootPhysicallyLocatable)
self.root = root = C('root')
More information about the Zope3-Checkins
mailing list