[Zope3-checkins] CVS: Zope3/src/zope/app/publication/tests -
test_browserpublication.py:1.24 test_zopepublication.py:1.25
Stephan Richter
srichter at cosmos.phy.tufts.edu
Mon Mar 8 07:06:30 EST 2004
Update of /cvs-repository/Zope3/src/zope/app/publication/tests
In directory cvs.zope.org:/tmp/cvs-serv13053/src/zope/app/publication/tests
Modified Files:
test_browserpublication.py test_zopepublication.py
Log Message:
Adjusted code to use the new APIs for permissions and principals. Also, use
the utility service instead of the permission registry to look up permissions.
=== Zope3/src/zope/app/publication/tests/test_browserpublication.py 1.23 => 1.24 ===
--- Zope3/src/zope/app/publication/tests/test_browserpublication.py:1.23 Fri Feb 20 11:57:27 2004
+++ Zope3/src/zope/app/publication/tests/test_browserpublication.py Mon Mar 8 07:05:59 2004
@@ -33,7 +33,7 @@
from zope.security.proxy import Proxy
from zope.security.checker import defineChecker, NamesChecker
-from zope.app.security.registries.principalregistry import principalRegistry
+from zope.app.security.principalregistry import principalRegistry
from zope.app.publication.browser import BrowserPublication
from zope.app.publication.traversers import TestTraverser
@@ -275,8 +275,7 @@
pub = self.klass(None)
class User:
- def getId(self):
- return 'bob'
+ id = 'bob'
# With a normal request, we should get a body:
output = StringIO()
=== Zope3/src/zope/app/publication/tests/test_zopepublication.py 1.24 => 1.25 ===
--- Zope3/src/zope/app/publication/tests/test_zopepublication.py:1.24 Wed Mar 3 05:38:48 2004
+++ Zope3/src/zope/app/publication/tests/test_zopepublication.py Mon Mar 8 07:05:59 2004
@@ -11,10 +11,10 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
-"""
+"""Zope Publication Tests
+
$Id$
"""
-
import unittest
import sys
from cStringIO import StringIO
@@ -36,8 +36,8 @@
from zope.app.tests import ztapi
from zope.app.services.servicenames import Authentication
-from zope.app.security.registries.principalregistry import principalRegistry
-from zope.app.interfaces.security import IUnauthenticatedPrincipal
+from zope.app.security.principalregistry import principalRegistry
+from zope.app.security.interfaces import IUnauthenticatedPrincipal, IPrincipal
from zope.app.publication.zopepublication import ZopePublication
from zope.app.folder import Folder, rootFolder
from zope.publisher.base import TestRequest
@@ -82,10 +82,11 @@
verifyClass(interface, TestPublication)
class Principal:
- def __init__(self, id): self._id = id
- def getId(self): return self._id
- def getTitle(self): return ''
- def getDescription(self): return ''
+ implements(IPrincipal)
+ def __init__(self, id):
+ self.id = id
+ self.title = ''
+ self.description = ''
class UnauthenticatedPrincipal(Principal):
implements(IUnauthenticatedPrincipal)
@@ -299,16 +300,16 @@
publication.beforeTraversal(request)
user = getSecurityManager().getPrincipal()
self.assertEqual(user, request.user)
- self.assertEqual(request.user.getId(), 'anonymous')
+ self.assertEqual(request.user.id, 'anonymous')
root = publication.getApplication(request)
publication.callTraversalHooks(request, root)
- self.assertEqual(request.user.getId(), 'anonymous')
+ self.assertEqual(request.user.id, 'anonymous')
ob = publication.traverseName(request, root, 'f1')
publication.callTraversalHooks(request, ob)
- self.assertEqual(request.user.getId(), 'test.anonymous')
+ self.assertEqual(request.user.id, 'test.anonymous')
ob = publication.traverseName(request, ob, 'f2')
publication.afterTraversal(request, ob)
- self.assertEqual(request.user.getId(), 'test.bob')
+ self.assertEqual(request.user.id, 'test.bob')
user = getSecurityManager().getPrincipal()
self.assertEqual(user, request.user)
More information about the Zope3-Checkins
mailing list