Test Request

This is something that I seem to forget how to do every time I need it.

If you have your unit tests set up properly, you should have a self.portal available inside your test class. self.portal has a request in it already, that can be accessed with self.portal.REQUEST.

The current trend in Plone is to use lower case request methods, but this isn’t currently available in this location. I would not be surprised if, in a few releases, self.portal.REQUEST becomes self.portal.request. In the meantime, self.portal.REQUEST works great for testing views.

Advertisements

~ by Liz on February 8, 2008.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: