Added display_for_value() tests for boolean values.

This commit is contained in:
Jonas Haag 2018-01-03 14:48:41 -05:00 committed by Tim Graham
parent acc8dd4142
commit ea10efebfa
1 changed files with 11 additions and 0 deletions

View File

@ -200,6 +200,17 @@ class UtilsTests(SimpleTestCase):
display_value = display_for_value([1, 2, 'buckle', 'my', 'shoe'], self.empty_value)
self.assertEqual(display_value, '1, 2, buckle, my, shoe')
@override_settings(USE_L10N=True, USE_THOUSAND_SEPARATOR=True)
def test_list_display_for_value_boolean(self):
self.assertEqual(
display_for_value(True, '', boolean=True),
'<img src="/static/admin/img/icon-yes.svg" alt="True" />'
)
self.assertEqual(
display_for_value(False, '', boolean=True),
'<img src="/static/admin/img/icon-no.svg" alt="False" />'
)
def test_label_for_field(self):
"""
Tests for label_for_field