[Zope3-Users] Calling a view in a doc test

Jim Washington jwashin at vt.edu
Mon Jun 4 09:31:31 EDT 2007


Florian Lindner wrote:
> Hello,
> in a doctest I have an object which has a view registered.
> I want to call this view and test for the XML it returns.
> How can I call the view so that it is being rendered, just like called by a 
> browser?
>
> Thanks,
>
> Florian
> _______________________________________________
> Zope3-users mailing list
> Zope3-users at zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users
>   
Hi, Florian

Search for zope.testbrowser.

It's sometimes used in functional doctests.

from zope.testbrowser.testing import Browser
browser = Browser('http://localhost/')
#browser.handleErrors = False
browser.open('/somepath/someview.html')

-Jim Washington


More information about the Zope3-users mailing list