diff options
| author | Tim Graham <timograham@gmail.com> | 2018-01-05 15:49:54 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2018-01-05 15:49:54 -0500 |
| commit | ec2ce4517ac89f6c6334fe5322d1fc2007dfcbd4 (patch) | |
| tree | 491ccf9d7c556ca46442af52b42ec71a260d077c /tests/forms_tests | |
| parent | 3333d935d2914cd80cf31f4803821ad5c0e2a51d (diff) | |
Fixed #28882 -- Fixed cleaning of disabled MultiValueFields.
Thanks avalanchy for the initial patch.
Diffstat (limited to 'tests/forms_tests')
| -rw-r--r-- | tests/forms_tests/field_tests/test_multivaluefield.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/forms_tests/field_tests/test_multivaluefield.py b/tests/forms_tests/field_tests/test_multivaluefield.py index e77bb0df26..cd446d07ce 100644 --- a/tests/forms_tests/field_tests/test_multivaluefield.py +++ b/tests/forms_tests/field_tests/test_multivaluefield.py @@ -62,6 +62,21 @@ class MultiValueFieldTest(SimpleTestCase): 'some text,JP,2007-04-25 06:24:00', ) + def test_clean_disabled_multivalue(self): + class ComplexFieldForm(Form): + f = ComplexField(disabled=True, widget=ComplexMultiWidget) + + inputs = ( + 'some text,JP,2007-04-25 06:24:00', + ['some text', ['J', 'P'], ['2007-04-25', '6:24:00']], + ) + for data in inputs: + with self.subTest(data=data): + form = ComplexFieldForm({}, initial={'f': data}) + form.full_clean() + self.assertEqual(form.errors, {}) + self.assertEqual(form.cleaned_data, {'f': inputs[0]}) + def test_bad_choice(self): msg = "'Select a valid choice. X is not one of the available choices.'" with self.assertRaisesMessage(ValidationError, msg): |
