From 35a08b8541c856a51b2ab718e0a2fe060debfa2a Mon Sep 17 00:00:00 2001 From: Basil Dubyk Date: Wed, 14 Nov 2018 20:43:34 +0200 Subject: Fixed #17210 -- Made NullBooleanSelect use unknown/true/false as query data. --- tests/forms_tests/tests/test_forms.py | 72 ++++++++++++-------- .../widget_tests/test_nullbooleanselect.py | 77 +++++++++++++++++----- 2 files changed, 106 insertions(+), 43 deletions(-) (limited to 'tests/forms_tests') diff --git a/tests/forms_tests/tests/test_forms.py b/tests/forms_tests/tests/test_forms.py index ba233e72ff..bad24b5230 100644 --- a/tests/forms_tests/tests/test_forms.py +++ b/tests/forms_tests/tests/test_forms.py @@ -2356,39 +2356,57 @@ Password: p = Person({'name': 'Joe'}, auto_id=False) self.assertHTMLEqual(str(p['is_cool']), """""") p = Person({'name': 'Joe', 'is_cool': '1'}, auto_id=False) self.assertHTMLEqual(str(p['is_cool']), """""") p = Person({'name': 'Joe', 'is_cool': '2'}, auto_id=False) self.assertHTMLEqual(str(p['is_cool']), """""") p = Person({'name': 'Joe', 'is_cool': '3'}, auto_id=False) self.assertHTMLEqual(str(p['is_cool']), """""") p = Person({'name': 'Joe', 'is_cool': True}, auto_id=False) self.assertHTMLEqual(str(p['is_cool']), """""") p = Person({'name': 'Joe', 'is_cool': False}, auto_id=False) self.assertHTMLEqual(str(p['is_cool']), """""") + p = Person({'name': 'Joe', 'is_cool': 'unknown'}, auto_id=False) + self.assertHTMLEqual(str(p['is_cool']), """""") + p = Person({'name': 'Joe', 'is_cool': 'true'}, auto_id=False) + self.assertHTMLEqual(str(p['is_cool']), """""") + p = Person({'name': 'Joe', 'is_cool': 'false'}, auto_id=False) + self.assertHTMLEqual(str(p['is_cool']), """""") def test_forms_with_file_fields(self): @@ -2758,9 +2776,9 @@ Good luck picking a username that doesn't already exist.

  • @@ -2774,9 +2792,9 @@ Good luck picking a username that doesn't already exist.

    @@ -2792,9 +2810,9 @@ Good luck picking a username that doesn't already exist.

    diff --git a/tests/forms_tests/widget_tests/test_nullbooleanselect.py b/tests/forms_tests/widget_tests/test_nullbooleanselect.py index 779a88893f..a732e86da4 100644 --- a/tests/forms_tests/widget_tests/test_nullbooleanselect.py +++ b/tests/forms_tests/widget_tests/test_nullbooleanselect.py @@ -11,36 +11,81 @@ class NullBooleanSelectTest(WidgetTest): def test_render_true(self): self.check_html(self.widget, 'is_cool', True, html=( """""" )) def test_render_false(self): self.check_html(self.widget, 'is_cool', False, html=( """""" )) def test_render_none(self): self.check_html(self.widget, 'is_cool', None, html=( """""" )) - def test_render_value(self): + def test_render_value_unknown(self): + self.check_html(self.widget, 'is_cool', 'unknown', html=( + """""" + )) + + def test_render_value_true(self): + self.check_html(self.widget, 'is_cool', 'true', html=( + """""" + )) + + def test_render_value_false(self): + self.check_html(self.widget, 'is_cool', 'false', html=( + """""" + )) + + def test_render_value_1(self): + self.check_html(self.widget, 'is_cool', '1', html=( + """""" + )) + + def test_render_value_2(self): self.check_html(self.widget, 'is_cool', '2', html=( """""" + )) + + def test_render_value_3(self): + self.check_html(self.widget, 'is_cool', '3', html=( + """""" )) @@ -55,9 +100,9 @@ class NullBooleanSelectTest(WidgetTest): self.check_html(widget, 'id_bool', True, html=( """ """ )) -- cgit v1.3