Hi there, one of the methods I call from a unittest changes a property. When called from "normal" zope it works fine. When I call the same function from a unittest it breaks saying that URL1" is not defined. Here is the code I use. The first time (no property it) works fine. The second time it breaks if self.hasProperty('poolGroup'): self.manage_changeProperties(REQUEST = {' poolGroup':= group}) else: self.manage_addProperty(id = 'poolGroup', type='string', value=group) Setting the Property like this: self.manage_changeProperties(REQUEST = None, poolGroup = group) does not generate an error, but does not change it. Any hints are greatly appreciated. Robert www.redcor.ch
Robert - the code you're calling is expecting a more complete REQUEST instance. You might find http://zwiki.org/zwikidir/tests/support.py useful, eg the MockRequest. Hope this helps, -Simon
Thank you very much Simon. This did the trick. If you could explain the difference between MockRequest and the functin makerequest() I would be doubbly gratefull. I would be happy if you point me to some info. I do not know what the Zope's app object ist, and I found no howto to enlighten me. Thanks again Robert ----- Original Message ----- From: "Simon Michael" <simon@joyful.com> To: <zope@zope.org> Sent: Sunday, April 28, 2002 5:58 PM Subject: [Zope] Re: [Zope]problems writing unit tests
Robert - the code you're calling is expecting a more complete REQUEST instance. You might find http://zwiki.org/zwikidir/tests/support.py useful, eg the MockRequest.
Hope this helps, -Simon
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
participants (2)
-
Robert Rottermann -
Simon Michael