On 08/01/2009, at 5:51 AM, csismondo wrote:
> I have a controller that I want to build unit test for, the controller
> is a web-based REST api, and I would like to know what you guys would
> recommend for a module.
I'm using the TestController that comes with a Pylons template project
for RESTful HTTP controller testing. This uses webtest as mentioned
by Jorge. In the tests you can just use calls like:
response = self.app.post(url('/new_app_submit'),
params=dict(app_name='testapp1', app_desc='Test app #1'))
response = self.app.put(url('/app/testapp1/purchases/user1/
productA'))
response = self.app.get(url('/app/testapp1/purchases'))
and test the response object for each case. e.g:
self.failUnlessEqual(response.status, '200 OK')
If you need a more thorough example of code just call out.
Cheers,
Chris Miles
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---