mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Fixed #11603 - Added django.test.SimpleTestCase.assertFormsetError
Thank-you Martin Green for the patch.
This commit is contained in:
parent
1e29428db2
commit
d194714c0a
7 changed files with 340 additions and 1 deletions
|
@ -1532,6 +1532,27 @@ your test suite.
|
|||
``errors`` is an error string, or a list of error strings, that are
|
||||
expected as a result of form validation.
|
||||
|
||||
.. method:: SimpleTestCase.assertFormsetError(response, formset, form_index, field, errors, msg_prefix='')
|
||||
|
||||
.. versionadded:: 1.6
|
||||
|
||||
Asserts that the ``formset`` raises the provided list of errors when
|
||||
rendered.
|
||||
|
||||
``formset`` is the name the ``Formset`` instance was given in the template
|
||||
context.
|
||||
|
||||
``form_index`` is the number of the form within the ``Formset``. If
|
||||
``form_index`` has a value of ``None``, non-form errors (errors you can
|
||||
access via ``formset.non_form_errors()``) will be checked.
|
||||
|
||||
``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.
|
||||
|
||||
.. method:: SimpleTestCase.assertContains(response, text, count=None, status_code=200, msg_prefix='', html=False)
|
||||
|
||||
Asserts that a ``Response`` instance produced the given ``status_code`` and
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue