Django TestCase: Inspecting Errors

I use PyCharm for all my Django projects. With PyCharm it is easy to set break points and inspect variables, although sometimes it is difficult to know what variables to look at. This is the case when trying to figure out form errors when running Django TestCase.

If the variable “response” contains the values returned by a post, then errors are at:

response.context_data['my_form'].errors

where errors is a dict.

Advertisements

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