diff options
| author | Peter Andersen <peter@porksmash.com> | 2019-12-09 08:54:40 -0800 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2019-12-11 09:37:34 +0100 |
| commit | 74e14541137d444b01fa947d7408f9d4a049ad9d (patch) | |
| tree | 471926cdb1344b0275c19fae72c69766c411519e /tests/postgres_tests/test_array.py | |
| parent | 314cb3a976ef642b8b941a47da90d0277eaa0038 (diff) | |
[3.0.x] Fixed #31073 -- Prevented CheckboxInput.get_context() from mutating attrs.
Backport of 02eff7ef60466da108b1a33f1e4dc01eec45c99d from master
Diffstat (limited to 'tests/postgres_tests/test_array.py')
| -rw-r--r-- | tests/postgres_tests/test_array.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/postgres_tests/test_array.py b/tests/postgres_tests/test_array.py index 42885e61f6..29b67d6fbc 100644 --- a/tests/postgres_tests/test_array.py +++ b/tests/postgres_tests/test_array.py @@ -1003,6 +1003,17 @@ class TestSplitFormWidget(PostgreSQLWidgetTestCase): } ) + def test_checkbox_get_context_attrs(self): + context = SplitArrayWidget( + forms.CheckboxInput(), + size=2, + ).get_context('name', [True, False]) + self.assertEqual(context['widget']['value'], '[True, False]') + self.assertEqual( + [subwidget['attrs'] for subwidget in context['widget']['subwidgets']], + [{'checked': True}, {}] + ) + def test_render(self): self.check_html( SplitArrayWidget(forms.TextInput(), size=2), 'array', None, |
