[Zope3-checkins] CVS: Zope3/src/zope/app/publication/tests -
test_zopepublication.py:1.17
Jim Fulton
jim at zope.com
Sun Sep 21 13:32:38 EDT 2003
Update of /cvs-repository/Zope3/src/zope/app/publication/tests
In directory cvs.zope.org:/tmp/cvs-serv14501/src/zope/app/publication/tests
Modified Files:
test_zopepublication.py
Log Message:
No-longer use context wrappers.
Changed to use __setitem__ rather than setObject
Use rootFolder helper function rather than RootFolder class.
=== Zope3/src/zope/app/publication/tests/test_zopepublication.py 1.16 => 1.17 ===
--- 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 Sun Sep 21 13:32:37 2003
@@ -37,15 +37,13 @@
from zope.app.publication.zopepublication import ZopePublication
-from zope.app.content.folder import Folder, RootFolder
+from zope.app.content.folder import Folder, rootFolder
from zope.component.interfaces import IServiceService
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
@@ -66,9 +64,9 @@
app = getattr(root, ZopePublication.root_name, None)
if app is None:
- from zope.app.content.folder import RootFolder
+ from zope.app.content.folder import rootFolder
- app = RootFolder()
+ app = rootFolder()
root[ZopePublication.root_name] = app
get_transaction().commit()
@@ -280,9 +278,9 @@
root = self.db.open().root()
app = root[ZopePublication.root_name]
- app.setObject('f1', Folder())
+ app['f1'] = Folder()
f1 = app['f1']
- f1.setObject('f2', Folder())
+ f1['f2'] = Folder()
f1.setSiteManager(ServiceManager(AuthService1()))
f2 = f1['f2']
f2.setSiteManager(ServiceManager(AuthService2()))
@@ -300,8 +298,7 @@
from zope.app.interfaces.content.folder import IFolder
from zope.security.checker import defineChecker, InterfaceChecker
defineChecker(Folder, InterfaceChecker(IFolder))
- defineChecker(RootFolder, InterfaceChecker(IFolder))
-
+
request.setViewType(IPresentation)
publication = ZopePublication(self.db)
@@ -309,26 +306,19 @@
publication.beforeTraversal(request)
user = getSecurityManager().getPrincipal()
self.assertEqual(user, request.user)
- self.assertEqual(getWrapperContext(user), principalRegistry)
self.assertEqual(request.user.getId(), 'anonymous')
- self.assertEqual(getWrapperContext(request.user), 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__,
- AuthService1)
ob = publication.traverseName(request, ob, 'f2')
publication.afterTraversal(request, ob)
self.assertEqual(request.user.getId(), 'test.bob')
- self.assertEqual(getWrapperContext(request.user).__class__,
- AuthService2)
user = getSecurityManager().getPrincipal()
self.assertEqual(user, request.user)
- self.assertEqual(getWrapperContext(user).__class__, AuthService2)
-
+
def test_suite():
return unittest.TestSuite((
More information about the Zope3-Checkins
mailing list