[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/ZopePublication/tests - testZopePublication.py:1.13
Jeremy Hylton
jeremy@zope.com
Wed, 24 Jul 2002 19:17:38 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/App/ZopePublication/tests
In directory cvs.zope.org:/tmp/cvs-serv5424/Zope/App/ZopePublication/tests
Modified Files:
testZopePublication.py
Log Message:
Code cleanup.
=== Zope3/lib/python/Zope/App/ZopePublication/tests/testZopePublication.py 1.12 => 1.13 ===
get_transaction().commit()
connection.close()
-
from Zope.App.Traversing.Namespaces import provideNamespaceHandler
from Zope.App.Traversing.PresentationNamespaces import view, resource
@@ -80,8 +79,6 @@
provideNamespaceHandler('resource', resource)
provideNamespaceHandler('etc', etc)
-
-
def tearDown(self):
setSecurityPolicy(self.policy) # XXX still needed?
PlacelessSetup.tearDown(self)
@@ -138,16 +135,13 @@
return serviceManager.getService(name)
-
class ZopePublicationTests(BasePublicationTests):
klass = ZopePublication
- def testPlacefullAuth(self):
+ def testPlacefulAuth(self):
principalRegistry.defineDefaultPrincipal('anonymous', '')
- db = self.db
- connection = db.open()
- root = connection.root()
+ root = self.db.open().root()
app = root[ZopePublication.root_name]
app.setObject('f1', Folder())
f1 = app['f1']
@@ -157,7 +151,6 @@
f2.setServiceManager(ServiceManager(AuthService2()))
get_transaction().commit()
-
request = TestRequest('/f1/f2')
from Zope.ComponentArchitecture.GlobalViewService import provideView
@@ -168,17 +161,13 @@
provideView(ISimpleReadContainer, '_traverse', IPresentation,
ContainerTraverser)
-
from Zope.App.OFS.Content.Folder.Folder import IFolder
from Zope.Security.Checker import defineChecker, InterfaceChecker
defineChecker(Folder, InterfaceChecker(IFolder))
defineChecker(RootFolder, InterfaceChecker(IFolder))
-
request.setViewType(IPresentation)
-
-
publication = self.klass(self.db)
publication.beforeTraversal(request)
@@ -193,12 +182,6 @@
publication.afterTraversal(request, ob)
self.assertEqual(request.user.getId(), 'test.bob')
-
-
-class SimpleObject:
- def __init__(self, v):
- self.v = v
-
def test_suite():
return unittest.makeSuite(ZopePublicationTests, 'test')