def testConvertLabelsToFieldValues_HasMatch(self): result = tracker_views._ConvertLabelsToFieldValues(['OSX'], 'opsys', {}) self.assertEqual(1, len(result)) self.assertEqual('OSX', result[0].val) self.assertEqual('', result[0].docstring) result = tracker_views._ConvertLabelsToFieldValues( ['OSX', 'All'], 'opsys', {'opsys-all': 'Happens everywhere'}) self.assertEqual(2, len(result)) self.assertEqual('OSX', result[0].val) self.assertEqual('', result[0].docstring) self.assertEqual('All', result[1].val) self.assertEqual('Happens everywhere', result[1].docstring)
def testConvertLabelsToFieldValues_HasMatch(self): result = tracker_views._ConvertLabelsToFieldValues( ['Pri-3', 'M-44', 'Security', 'OpSys-OSX'], 'opsys', {}) self.assertEqual(1, len(result)) self.assertEqual('OSX', result[0].val) self.assertEqual('OSX', result[0].val_short) self.assertEqual('', result[0].docstring) result = tracker_views._ConvertLabelsToFieldValues( ['Pri-3', 'M-44', 'Security', 'OpSys-OSX', 'OpSys-All'], 'opsys', {'OpSys-All': 'Happens everywhere'}) self.assertEqual(2, len(result)) self.assertEqual('OSX', result[0].val) self.assertEqual('OSX', result[0].val_short) self.assertEqual('', result[0].docstring) self.assertEqual('All', result[1].val) self.assertEqual('All', result[1].val_short) self.assertEqual('Happens everywhere', result[1].docstring)
def testConvertLabelsToFieldValues_NoMatch(self): result = tracker_views._ConvertLabelsToFieldValues( ['Pri-3', 'M-44', 'Security', 'Via-Wizard'], 'opsys', {}) self.assertEqual([], result)
def testConvertLabelsToFieldValues_NoLabels(self): result = tracker_views._ConvertLabelsToFieldValues( [], 'opsys', {}) self.assertEqual([], result)