diff --git a/tests/unit/test_form.py b/tests/unit/test_form.py index 68223f7a5..bee3767c3 100644 --- a/tests/unit/test_form.py +++ b/tests/unit/test_form.py @@ -100,22 +100,22 @@ def test_metadata_wrapping(self): def test_radio_button_label(self): """Check that appropriate radio button label is returned.""" - test_labels_list = [ - ('detection_bug', 'Desktop site instead of mobile site'), - ('unknown_bug', 'Something else') + tests_labels_lists = [ + [('detection_bug', 'i.svg', 'Desktop site instead of mobile site'), + ('unknown_bug', 'b.svg', 'Something else')], + [('detection_bug', 'Desktop site instead of mobile site'), + ('unknown_bug', 'Something else')], ] - r = form.get_radio_button_label('unknown_bug', test_labels_list) - self.assertEqual(r, 'Something else') - - r = form.get_radio_button_label('detection_bug', test_labels_list) - self.assertEqual(r, 'Desktop site instead of mobile site') - - r = form.get_radio_button_label(None, test_labels_list) - self.assertEqual(r, 'Unknown') - - r = form.get_radio_button_label('failme', test_labels_list) - self.assertEqual(r, 'Unknown') + for test_labels_list in tests_labels_lists: + r = form.get_radio_button_label('unknown_bug', test_labels_list) + self.assertEqual(r, 'Something else') + r = form.get_radio_button_label('detection_bug', test_labels_list) + self.assertEqual(r, 'Desktop site instead of mobile site') + r = form.get_radio_button_label(None, test_labels_list) + self.assertEqual(r, 'Unknown') + r = form.get_radio_button_label('failme', test_labels_list) + self.assertEqual(r, 'Unknown') def test_get_form(self): """Check we return the right form with the appropriate data.""" diff --git a/webcompat/form.py b/webcompat/form.py index f403f2e68..0806b8d0e 100644 --- a/webcompat/form.py +++ b/webcompat/form.py @@ -329,6 +329,8 @@ def build_details(details): def get_radio_button_label(field_value, label_list): """Return human-readable label for problem choices form value.""" + if len(label_list[0]) == 3: + label_list = [(value, text) for value, icon, text in label_list] for value, text in label_list: if value == field_value: return text