diff options
| author | Tim Graham <timograham@gmail.com> | 2013-02-08 18:45:26 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2013-05-27 12:25:35 -0400 |
| commit | d194714c0a707773bd470bffb3d67a60e40bb787 (patch) | |
| tree | b574c8acda0d9e00b74cc994aaf019d258b2e5ad /docs | |
| parent | 1e29428db292a8d2c5a4c6492ab1407834081235 (diff) | |
Fixed #11603 - Added django.test.SimpleTestCase.assertFormsetError
Thank-you Martin Green for the patch.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/releases/1.6.txt | 4 | ||||
| -rw-r--r-- | docs/topics/testing/overview.txt | 21 |
2 files changed, 25 insertions, 0 deletions
diff --git a/docs/releases/1.6.txt b/docs/releases/1.6.txt index 4a8f7c6ecf..4f4b615835 100644 --- a/docs/releases/1.6.txt +++ b/docs/releases/1.6.txt @@ -283,6 +283,10 @@ Minor features * The :meth:`~django.db.models.query.QuerySet.get_or_create` method no longer requires at least one keyword argument. +* The :class:`~django.test.SimpleTestCase` class includes a new assertion + helper for testing formset errors: + :meth:`~django.test.SimpleTestCase.assertFormsetError`. + Backwards incompatible changes in 1.6 ===================================== diff --git a/docs/topics/testing/overview.txt b/docs/topics/testing/overview.txt index 3669bff8bf..470051e78e 100644 --- a/docs/topics/testing/overview.txt +++ b/docs/topics/testing/overview.txt @@ -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 |
