Make some tests run: provide default traversal adapter so that simple path

traversal works.
parent 48526ec0
......@@ -13,6 +13,8 @@
import os, sys, unittest
import zope.component.testing
from zope.traversing.adapters import DefaultTraversable
from Products.PageTemplates.tests import util
from Products.PageTemplates.PageTemplate import PageTemplate
from Acquisition import Implicit
......@@ -43,16 +45,20 @@ class UnitTestSecurityPolicy:
def checkPermission( self, permission, object, context) :
return 1
class DTMLTests(unittest.TestCase):
class DTMLTests(zope.component.testing.PlacelessSetup, unittest.TestCase):
def setUp(self):
self.t=(AqPageTemplate())
super(DTMLTests, self).setUp()
zope.component.provideAdapter(DefaultTraversable, (None,))
self.t = AqPageTemplate()
self.policy = UnitTestSecurityPolicy()
self.oldPolicy = SecurityManager.setSecurityPolicy( self.policy )
self.oldPolicy = SecurityManager.setSecurityPolicy(self.policy)
noSecurityManager() # Use the new policy.
def tearDown(self):
SecurityManager.setSecurityPolicy( self.oldPolicy )
super(DTMLTests, self).tearDown()
SecurityManager.setSecurityPolicy(self.oldPolicy)
noSecurityManager() # Reset to old policy.
def check1(self):
......
......@@ -13,6 +13,8 @@
import os, sys, unittest
import zope.component.testing
from zope.traversing.adapters import DefaultTraversable
from Products.PageTemplates.tests import util
from Products.PageTemplates.PageTemplate import PageTemplate
from Products.PageTemplates.GlobalTranslationService import \
......@@ -59,9 +61,12 @@ class UnitTestSecurityPolicy:
def checkPermission( self, permission, object, context) :
return 1
class HTMLTests(unittest.TestCase):
class HTMLTests(zope.component.testing.PlacelessSetup, unittest.TestCase):
def setUp(self):
super(HTMLTests, self).setUp()
zope.component.provideAdapter(DefaultTraversable, (None,))
self.folder = f = Folder()
f.laf = AqPageTemplate()
f.t = AqPageTemplate()
......@@ -70,6 +75,7 @@ class HTMLTests(unittest.TestCase):
noSecurityManager() # Use the new policy.
def tearDown(self):
super(HTMLTests, self).tearDown()
SecurityManager.setSecurityPolicy( self.oldPolicy )
noSecurityManager() # Reset to old policy.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment