[Zope3-checkins] CVS: Zope3/src/zope/app/traversing/tests -
test_namespacetrversal.py:1.9
Jim Fulton
jim at zope.com
Fri Aug 8 15:07:49 EDT 2003
Update of /cvs-repository/Zope3/src/zope/app/traversing/tests
In directory cvs.zope.org:/tmp/cvs-serv5563/src/zope/app/traversing/tests
Modified Files:
test_namespacetrversal.py
Log Message:
Changed to use a stub handler to test handling side-effect names.
=== Zope3/src/zope/app/traversing/tests/test_namespacetrversal.py 1.8 => 1.9 ===
--- Zope3/src/zope/app/traversing/tests/test_namespacetrversal.py:1.8 Sat Aug 2 14:17:28 2003
+++ Zope3/src/zope/app/traversing/tests/test_namespacetrversal.py Fri Aug 8 14:07:44 2003
@@ -18,6 +18,9 @@
from unittest import TestCase, main, makeSuite
from zope.testing.cleanup import CleanUp # Base class w registry cleanup
+from zope.app.traversing.namespace import provideNamespaceHandler
+from zope.app.traversing.namespace import attr, item
+from zope.app.traversing.adapters import Traverser
class C:
a = 1
@@ -25,25 +28,23 @@
c=C()
+def noop(name, parameters, pname, ob, request):
+ return ob
+
class Test(CleanUp, TestCase):
def setUp(self):
- from zope.app.traversing.namespace import provideNamespaceHandler
- from zope.app.traversing.namespace import attr, item
- from zope.app.traversing.namespace import skin
provideNamespaceHandler('attribute', attr)
provideNamespaceHandler('item', item)
- provideNamespaceHandler('skin', skin)
+ provideNamespaceHandler('noop', noop)
def testAttr(self):
- from zope.app.traversing.adapters import Traverser
traverser = Traverser(c)
v = traverser.traverse('++attribute++a')
self.assertEqual(v, 1)
def testItem(self):
- from zope.app.traversing.adapters import Traverser
traverser = Traverser(c)
v = traverser.traverse('++item++a')
self.assertEqual(v, 'avalue')
@@ -51,19 +52,11 @@
def testSideEffectsContextDetail(self):
# Check to make sure that when we traverse something in context,
# that we get the right context for the result.
- from zope.app.context import ContextWrapper
- from zope.context import getWrapperContainer
- from zope.app.traversing.adapters import Traverser
- from zope.publisher.browser import TestRequest
-
- c1 = C()
- c2 = C()
- c2c1 = ContextWrapper(c2, c1)
-
- traverser = Traverser(c2c1)
- v = traverser.traverse('++skin++ZopeTop', request=TestRequest())
- self.assertEqual(v, c2)
- self.failUnless(getWrapperContainer(v) is c1)
+
+ c = C()
+ traverser = Traverser(c)
+ v = traverser.traverse('++noop++yeeha')
+ self.assert_(v is c)
def test_suite():
More information about the Zope3-Checkins
mailing list