[Zope3-checkins] CVS: Zope3/src/zope/app/publication/tests -
test_browserpublication.py:1.18.2.1
test_xmlrpcpublication.py:1.2.2.1 test_zopepublication.py:1.16.2.1
Jim Fulton
jim at zope.com
Mon Sep 8 15:22:16 EDT 2003
Update of /cvs-repository/Zope3/src/zope/app/publication/tests
In directory cvs.zope.org:/tmp/cvs-serv20092/src/zope/app/publication/tests
Modified Files:
Tag: parentgeddon-branch
test_browserpublication.py test_xmlrpcpublication.py
test_zopepublication.py
Log Message:
Checking in work in progress on parentgeddon-branch so Fred can help
me to get the tests passing. Specific log entries will be provided
when we merge this into the head.
=== Zope3/src/zope/app/publication/tests/test_browserpublication.py 1.18 => 1.18.2.1 ===
--- 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 Mon Sep 8 14:21:45 2003
@@ -29,7 +29,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 +171,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 +191,7 @@
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.assertEqual(ob2.v, 'bruce')
def testAdaptedTraverseDefaultWrapping(self):
# Test default content and make sure that it's wrapped.
@@ -225,10 +211,6 @@
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')
# XXX we no longer support path parameters! (At least for now)
@@ -262,8 +244,8 @@
provideView=getService(None, Views).provideView
provideView(None, '_traverse', IBrowserPresentation, [TestTraverser])
ob2 = pub.traverseName(r, ob, 'x')
- self.assertEqual(removeAllProxies(ob2).v, 1)
- self.assertEqual(getWrapperContext(ob2), ob)
+ self.assertEqual(ob2.v, 1)
+ self.assertEqual(ob2.__parent__, ob)
def testTraverseNameView(self):
pub = self.klass(self.db)
@@ -278,8 +260,8 @@
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)
+ self.assertEqual(ob2.__parent__, ob)
def testTraverseNameServices(self):
pub = self.klass(self.db)
@@ -289,8 +271,8 @@
ob = C()
r = self._createRequest('/++etc++site',pub)
ob2 = pub.traverseName(r, ob, '++etc++site')
- self.assertEqual(removeAllProxies(ob2).v, 1)
- self.assertEqual(getWrapperContext(ob2), ob)
+ self.assertEqual(ob2.v, 1)
+ self.assertEqual(ob2.__parent__, ob)
def testTraverseNameApplicationControl(self):
from zope.app.applicationcontrol.applicationcontrol \
=== Zope3/src/zope/app/publication/tests/test_xmlrpcpublication.py 1.2 => 1.2.2.1 ===
--- 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 Mon Sep 8 14:21:45 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,7 @@
provideView(None, '_traverse', IXMLRPCPresentation, [TestTraverser])
ob2 = pub.traverseName(r, ob, 'x')
self.assertEqual(removeAllProxies(ob2).v, 1)
- self.assertEqual(getWrapperContext(ob2), ob)
+ self.assertEqual(ob2.__parent__, ob)
def testDenyDirectMethodAccess(self):
pub = self.klass(self.db)
@@ -103,11 +102,11 @@
provideView(I, 'spam', IXMLRPCPresentation, [V])
ob2 = pub.traverseName(r, ob, '@@spam')
self.assertEqual(removeAllProxies(ob2).__class__, V)
- self.assertEqual(getWrapperContext(ob2), ob)
+ self.assertEqual(ob2.__parent__, ob)
ob2 = pub.traverseName(r, ob, 'spam')
self.assertEqual(removeAllProxies(ob2).__class__, V)
- self.assertEqual(getWrapperContext(ob2), ob)
+ self.assertEqual(ob2.__parent__, ob)
def testTraverseNameDefaultView(self):
@@ -138,11 +137,11 @@
ob2 = pub.traverseName(r, ob, '@@spam')
self.assertEqual(removeAllProxies(ob2).__name__, V.spam.__name__)
- self.assertEqual(getWrapperContext(ob2), ob)
+ self.assertEqual(ob2.__parent__, ob)
ob2 = pub.traverseName(r, ob, 'spam')
self.assertEqual(removeAllProxies(ob2).__name__, V.spam.__name__)
- self.assertEqual(getWrapperContext(ob2), ob)
+ self.assertEqual(ob2.__parent__, ob)
def testTraverseNameServices(self):
@@ -154,7 +153,7 @@
r = self._createRequest('/++etc++site',pub)
ob2 = pub.traverseName(r, ob, '++etc++site')
self.assertEqual(removeAllProxies(ob2).v, 1)
- self.assertEqual(getWrapperContext(ob2), ob)
+ self.assertEqual(ob2.__parent__, ob)
def test_suite():
=== Zope3/src/zope/app/publication/tests/test_zopepublication.py 1.16 => 1.16.2.1 ===
--- Zope3/src/zope/app/publication/tests/test_zopepublication.py:1.16 Tue Sep 2 16:46:49 2003
+++ Zope3/src/zope/app/publication/tests/test_zopepublication.py Mon Sep 8 14:21:45 2003
@@ -44,8 +44,6 @@
from zope.publisher.base import TestRequest
from zope.publisher.browser import BrowserResponse
-from zope.context import getWrapperContext
-
from transaction import get_transaction
from cStringIO import StringIO
@@ -309,25 +307,25 @@
publication.beforeTraversal(request)
user = getSecurityManager().getPrincipal()
self.assertEqual(user, request.user)
- self.assertEqual(getWrapperContext(user), principalRegistry)
+ self.assertEqual(user.__parent__, principalRegistry)
self.assertEqual(request.user.getId(), 'anonymous')
- self.assertEqual(getWrapperContext(request.user), principalRegistry)
+ self.assertEqual(request.user.__parent__, principalRegistry)
root = publication.getApplication(request)
publication.callTraversalHooks(request, root)
self.assertEqual(request.user.getId(), 'anonymous')
ob = publication.traverseName(request, root, 'f1')
publication.callTraversalHooks(request, ob)
self.assertEqual(request.user.getId(), 'test.anonymous')
- self.assertEqual(getWrapperContext(request.user).__class__,
+ self.assertEqual(request.user.__parent__.__class__,
AuthService1)
ob = publication.traverseName(request, ob, 'f2')
publication.afterTraversal(request, ob)
self.assertEqual(request.user.getId(), 'test.bob')
- self.assertEqual(getWrapperContext(request.user).__class__,
+ self.assertEqual(request.user.__parent__.__class__,
AuthService2)
user = getSecurityManager().getPrincipal()
self.assertEqual(user, request.user)
- self.assertEqual(getWrapperContext(user).__class__, AuthService2)
+ self.assertEqual(user.__parent__.__class__, AuthService2)
def test_suite():
More information about the Zope3-Checkins
mailing list