[Zope3-checkins] CVS: Zope3/src/zope/app/publication/tests -
test_browserpublication.py:1.19 test_xmlrpcpublication.py:1.3
Jim Fulton
jim at zope.com
Sun Sep 21 13:32:28 EDT 2003
Update of /cvs-repository/Zope3/src/zope/app/publication/tests
In directory cvs.zope.org:/tmp/cvs-serv13558/src/zope/app/publication/tests
Modified Files:
test_browserpublication.py test_xmlrpcpublication.py
Log Message:
No-longer use context wrappers.
=== Zope3/src/zope/app/publication/tests/test_browserpublication.py 1.18 => 1.19 ===
--- Zope3/src/zope/app/publication/tests/test_browserpublication.py:1.18 Tue Sep 2 16:46:49 2003
+++ Zope3/src/zope/app/publication/tests/test_browserpublication.py Sun Sep 21 13:31:57 2003
@@ -19,6 +19,7 @@
from StringIO import StringIO
+from zope.exceptions import ForbiddenAttribute
from zope.interface import Interface, implements
from zope.component import getService
@@ -29,7 +30,6 @@
from zope.publisher.interfaces.browser \
import IBrowserPresentation, IBrowserPublisher
-from zope.context import getWrapperContext, isWrapper
from zope.proxy import removeAllProxies, getProxiedObject
from zope.security.proxy import Proxy
from zope.security.checker import defineChecker, NamesChecker
@@ -172,15 +172,6 @@
klass = BrowserPublication
- def testNativeTraverseNameWrapping(self):
- pub = self.klass(self.db)
- ob = DummyPublished()
- ob2 = pub.traverseName(self._createRequest('/bruce', pub), ob, 'bruce')
- self.failUnless(ob2 is not ob)
- self.failUnless(type(ob2) is Proxy)
- ob2 = getProxiedObject(ob2)
- self.failUnless(isWrapper(ob2))
-
def testAdaptedTraverseNameWrapping(self):
class Adapter:
@@ -201,11 +192,8 @@
ob['bruce2'] = SimpleObject('bruce2')
pub = self.klass(self.db)
ob2 = pub.traverseName(self._createRequest('/bruce', pub), ob, 'bruce')
- self.failUnless(type(ob2) is Proxy)
- ob2 = getProxiedObject(ob2)
- self.failUnless(isWrapper(ob2))
- unw = removeAllProxies(ob2)
- self.assertEqual(unw.v, 'bruce')
+ self.assertRaises(ForbiddenAttribute, getattr, ob2, 'v')
+ self.assertEqual(removeAllProxies(ob2).v, 'bruce')
def testAdaptedTraverseDefaultWrapping(self):
# Test default content and make sure that it's wrapped.
@@ -225,11 +213,8 @@
pub = self.klass(self.db)
ob2, x = pub.getDefaultTraversal(self._createRequest('/bruce',pub), ob)
self.assertEqual(x, 'dummy')
- self.failUnless(type(ob2) is Proxy)
- ob2 = getProxiedObject(ob2)
- self.failUnless(isWrapper(ob2))
- unw = removeAllProxies(ob2)
- self.assertEqual(unw.v, 'bruce')
+ self.assertRaises(ForbiddenAttribute, getattr, ob2, 'v')
+ self.assertEqual(removeAllProxies(ob2).v, 'bruce')
# XXX we no longer support path parameters! (At least for now)
def XXXtestTraverseSkinExtraction(self):
@@ -262,8 +247,8 @@
provideView=getService(None, Views).provideView
provideView(None, '_traverse', IBrowserPresentation, [TestTraverser])
ob2 = pub.traverseName(r, ob, 'x')
+ self.assertRaises(ForbiddenAttribute, getattr, ob2, 'v')
self.assertEqual(removeAllProxies(ob2).v, 1)
- self.assertEqual(getWrapperContext(ob2), ob)
def testTraverseNameView(self):
pub = self.klass(self.db)
@@ -278,8 +263,7 @@
provideView=getService(None, Views).provideView
provideView(I, 'spam', IBrowserPresentation, [V])
ob2 = pub.traverseName(r, ob, '@@spam')
- self.assertEqual(removeAllProxies(ob2).__class__, V)
- self.assertEqual(getWrapperContext(ob2), ob)
+ self.assertEqual(ob2.__class__, V)
def testTraverseNameServices(self):
pub = self.klass(self.db)
@@ -289,8 +273,8 @@
ob = C()
r = self._createRequest('/++etc++site',pub)
ob2 = pub.traverseName(r, ob, '++etc++site')
+ self.assertRaises(ForbiddenAttribute, getattr, ob2, 'v')
self.assertEqual(removeAllProxies(ob2).v, 1)
- self.assertEqual(getWrapperContext(ob2), ob)
def testTraverseNameApplicationControl(self):
from zope.app.applicationcontrol.applicationcontrol \
=== Zope3/src/zope/app/publication/tests/test_xmlrpcpublication.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/publication/tests/test_xmlrpcpublication.py:1.2 Tue Sep 2 16:46:49 2003
+++ Zope3/src/zope/app/publication/tests/test_xmlrpcpublication.py Sun Sep 21 13:31:57 2003
@@ -23,7 +23,6 @@
from zope.app.publication.xmlrpc import XMLRPCPublication
from zope.app.services.servicenames import Views
from zope.component import getService
-from zope.context import getWrapperContext
from zope.interface import Interface, implements
from zope.proxy import removeAllProxies
from zope.publisher.interfaces import NotFound
@@ -55,7 +54,6 @@
provideView(None, '_traverse', IXMLRPCPresentation, [TestTraverser])
ob2 = pub.traverseName(r, ob, 'x')
self.assertEqual(removeAllProxies(ob2).v, 1)
- self.assertEqual(getWrapperContext(ob2), ob)
def testDenyDirectMethodAccess(self):
pub = self.klass(self.db)
@@ -103,12 +101,10 @@
provideView(I, 'spam', IXMLRPCPresentation, [V])
ob2 = pub.traverseName(r, ob, '@@spam')
self.assertEqual(removeAllProxies(ob2).__class__, V)
- self.assertEqual(getWrapperContext(ob2), ob)
-
+
ob2 = pub.traverseName(r, ob, 'spam')
self.assertEqual(removeAllProxies(ob2).__class__, V)
- self.assertEqual(getWrapperContext(ob2), ob)
-
+
def testTraverseNameDefaultView(self):
pub = self.klass(self.db)
@@ -138,11 +134,9 @@
ob2 = pub.traverseName(r, ob, '@@spam')
self.assertEqual(removeAllProxies(ob2).__name__, V.spam.__name__)
- self.assertEqual(getWrapperContext(ob2), ob)
ob2 = pub.traverseName(r, ob, 'spam')
self.assertEqual(removeAllProxies(ob2).__name__, V.spam.__name__)
- self.assertEqual(getWrapperContext(ob2), ob)
def testTraverseNameServices(self):
@@ -154,7 +148,6 @@
r = self._createRequest('/++etc++site',pub)
ob2 = pub.traverseName(r, ob, '++etc++site')
self.assertEqual(removeAllProxies(ob2).v, 1)
- self.assertEqual(getWrapperContext(ob2), ob)
def test_suite():
More information about the Zope3-Checkins
mailing list