On 7/26/07, Chris Gray <[EMAIL PROTECTED]> wrote:
 Is there any standard way of unit testing the two page templating
methods in Zope 2?

Chris


If you're trying to test the output produced by a dtml/zpt, you could
try to invoke it, inside a zopetestcase.

Something like:

self.app.index_html = PageTemplateFile(path_to_your_template, globals())

x = self.app.index_html();

self.assertEquals("some_string", x);

I'm using here PageTemplateFile, but you can do it with standard
ZopePageTemplate.

The problem is what you're trying to test (and, therefore, to assert).
Checking for equality is too fine grained, where you would check for
the structure of the zpt, for example. A little parser could be
useful.

Regards
Marco


--
Marco Bizzarri
http://iliveinpisa.blogspot.com/
_______________________________________________
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to