[Zope3-checkins] CVS: Zope3/src/zope/app/publication/tests -
test_browserpublication.py:1.18.2.2
test_xmlrpcpublication.py:1.2.2.2 test_zopepublication.py:1.16.2.2
Jim Fulton
jim at zope.com
Tue Sep 9 12:47:37 EDT 2003
Update of /cvs-repository/Zope3/src/zope/app/publication/tests
In directory cvs.zope.org:/tmp/cvs-serv13092/src/zope/app/publication/tests
Modified Files:
Tag: parentgeddon-branch
test_browserpublication.py test_xmlrpcpublication.py
test_zopepublication.py
Log Message:
got more tests to pass
=== Zope3/src/zope/app/publication/tests/test_browserpublication.py 1.18.2.1 => 1.18.2.2 ===
--- Zope3/src/zope/app/publication/tests/test_browserpublication.py:1.18.2.1 Mon Sep 8 14:21:45 2003
+++ Zope3/src/zope/app/publication/tests/test_browserpublication.py Tue Sep 9 11:47:06 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
@@ -191,7 +192,8 @@
ob['bruce2'] = SimpleObject('bruce2')
pub = self.klass(self.db)
ob2 = pub.traverseName(self._createRequest('/bruce', pub), ob, 'bruce')
- self.assertEqual(ob2.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.
@@ -211,7 +213,8 @@
pub = self.klass(self.db)
ob2, x = pub.getDefaultTraversal(self._createRequest('/bruce',pub), ob)
self.assertEqual(x, 'dummy')
- 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):
@@ -244,8 +247,8 @@
provideView=getService(None, Views).provideView
provideView(None, '_traverse', IBrowserPresentation, [TestTraverser])
ob2 = pub.traverseName(r, ob, 'x')
- self.assertEqual(ob2.v, 1)
- self.assertEqual(ob2.__parent__, ob)
+ self.assertRaises(ForbiddenAttribute, getattr, ob2, 'v')
+ self.assertEqual(removeAllProxies(ob2).v, 1)
def testTraverseNameView(self):
pub = self.klass(self.db)
@@ -261,7 +264,6 @@
provideView(I, 'spam', IBrowserPresentation, [V])
ob2 = pub.traverseName(r, ob, '@@spam')
self.assertEqual(ob2.__class__, V)
- self.assertEqual(ob2.__parent__, ob)
def testTraverseNameServices(self):
pub = self.klass(self.db)
@@ -271,8 +273,8 @@
ob = C()
r = self._createRequest('/++etc++site',pub)
ob2 = pub.traverseName(r, ob, '++etc++site')
- self.assertEqual(ob2.v, 1)
- self.assertEqual(ob2.__parent__, ob)
+ self.assertRaises(ForbiddenAttribute, getattr, ob2, 'v')
+ self.assertEqual(removeAllProxies(ob2).v, 1)
def testTraverseNameApplicationControl(self):
from zope.app.applicationcontrol.applicationcontrol \
=== Zope3/src/zope/app/publication/tests/test_xmlrpcpublication.py 1.2.2.1 => 1.2.2.2 ===
--- Zope3/src/zope/app/publication/tests/test_xmlrpcpublication.py:1.2.2.1 Mon Sep 8 14:21:45 2003
+++ Zope3/src/zope/app/publication/tests/test_xmlrpcpublication.py Tue Sep 9 11:47:06 2003
@@ -54,7 +54,6 @@
provideView(None, '_traverse', IXMLRPCPresentation, [TestTraverser])
ob2 = pub.traverseName(r, ob, 'x')
self.assertEqual(removeAllProxies(ob2).v, 1)
- self.assertEqual(ob2.__parent__, ob)
def testDenyDirectMethodAccess(self):
pub = self.klass(self.db)
@@ -102,12 +101,10 @@
provideView(I, 'spam', IXMLRPCPresentation, [V])
ob2 = pub.traverseName(r, ob, '@@spam')
self.assertEqual(removeAllProxies(ob2).__class__, V)
- self.assertEqual(ob2.__parent__, ob)
-
+
ob2 = pub.traverseName(r, ob, 'spam')
self.assertEqual(removeAllProxies(ob2).__class__, V)
- self.assertEqual(ob2.__parent__, ob)
-
+
def testTraverseNameDefaultView(self):
pub = self.klass(self.db)
@@ -137,11 +134,9 @@
ob2 = pub.traverseName(r, ob, '@@spam')
self.assertEqual(removeAllProxies(ob2).__name__, V.spam.__name__)
- self.assertEqual(ob2.__parent__, ob)
ob2 = pub.traverseName(r, ob, 'spam')
self.assertEqual(removeAllProxies(ob2).__name__, V.spam.__name__)
- self.assertEqual(ob2.__parent__, ob)
def testTraverseNameServices(self):
@@ -153,7 +148,6 @@
r = self._createRequest('/++etc++site',pub)
ob2 = pub.traverseName(r, ob, '++etc++site')
self.assertEqual(removeAllProxies(ob2).v, 1)
- self.assertEqual(ob2.__parent__, ob)
def test_suite():
=== Zope3/src/zope/app/publication/tests/test_zopepublication.py 1.16.2.1 => 1.16.2.2 ===
--- Zope3/src/zope/app/publication/tests/test_zopepublication.py:1.16.2.1 Mon Sep 8 14:21:45 2003
+++ Zope3/src/zope/app/publication/tests/test_zopepublication.py Tue Sep 9 11:47:06 2003
@@ -307,26 +307,19 @@
publication.beforeTraversal(request)
user = getSecurityManager().getPrincipal()
self.assertEqual(user, request.user)
- self.assertEqual(user.__parent__, principalRegistry)
self.assertEqual(request.user.getId(), 'anonymous')
- 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(request.user.__parent__.__class__,
- AuthService1)
ob = publication.traverseName(request, ob, 'f2')
publication.afterTraversal(request, ob)
self.assertEqual(request.user.getId(), 'test.bob')
- self.assertEqual(request.user.__parent__.__class__,
- AuthService2)
user = getSecurityManager().getPrincipal()
self.assertEqual(user, request.user)
- self.assertEqual(user.__parent__.__class__, AuthService2)
-
+
def test_suite():
return unittest.TestSuite((
More information about the Zope3-Checkins
mailing list