test.SimpleTestCase.assertFormError()

SimpleTestCase.assertFormError(response, form, field, errors, msg_prefix='') [source]

Asserts that a field on a form raises the provided list of errors when rendered on the form.

form is the name the Form instance was given in the template context.

field is the name of the field on the form to check. If field has a value of None, non-field errors (errors you can access via form.non_field_errors()) will be checked.

errors is an error string, or a list of error strings, that are expected as a result of form validation.

doc_Django
2016-10-09 18:40:04
Comments
Leave a Comment

Please login to continue.