[Zope-Checkins]
SVN: Zope/trunk/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py
Macro expansion currenty fails. I checked in a test that
reproduces the error.
Lennart Regebro
regebro at gmail.com
Fri Apr 21 12:40:04 EDT 2006
Log message for revision 67230:
Macro expansion currenty fails. I checked in a test that reproduces the error.
Changed:
U Zope/trunk/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py
-=-
Modified: Zope/trunk/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py
===================================================================
--- Zope/trunk/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py 2006-04-21 16:38:39 UTC (rev 67229)
+++ Zope/trunk/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py 2006-04-21 16:40:03 UTC (rev 67230)
@@ -58,6 +58,44 @@
pt = self.app.pt1
self.assertEqual(pt.document_src(), self.text)
+class ZPTMacros(unittest.TestCase):
+ def setUp(self):
+ transaction.begin()
+ self.app = makerequest(Zope2.app())
+ f = self.app.manage_addProduct['PageTemplates'].manage_addPageTemplate
+ self._addPT = f
+ self.title = 'title of page template'
+ self.text = """
+<metal:block use-macro="template/macros/themacro">
+ <p metal:fill-slot="theslot">
+ This is in the slot
+ </p>
+</metal:block>
+<tal:block condition="default">
+<div metal:define-macro="themacro">
+ <h1>This is the header</h1>
+ <p metal:define-slot="theslot">
+ This will be replaced
+ </p>
+</div>
+</tal:block>
+"""
+ self.result = """
+<div>
+ <h1>This is the header</h1>
+ <p>
+ This is in the slot
+ </p>
+</div>
+
+"""
+
+ def testMacroExpansion(self):
+ request = self.app.REQUEST
+ self._addPT('pt1', text=self.text, REQUEST=request)
+ pt = self.app.pt1
+ self.assertEqual(pt(), self.result)
+
class DummyFileUpload:
@@ -71,7 +109,9 @@
def test_suite():
- return unittest.makeSuite(ZPTRegressions)
+ suite = unittest.makeSuite(ZPTRegressions)
+ suite.addTests(unittest.makeSuite(ZPTMacros))
+ return suite
if __name__ == '__main__':
unittest.main(defaultTest='test_suite')
More information about the Zope-Checkins
mailing list