def test_impact_for_tracker_with_unspecified_severity(self): bugs = [] severity = "unspecified" bugs.append(flexmock(id=123, severity=severity)) tracker_flaws_map = { 123: [flexmock(id=123, severity="medium")], } impact = bzutil.get_highest_impact(bugs, tracker_flaws_map) self.assertEqual(impact, "Moderate") tracker_flaws_map = { 123: [flexmock(id=123, severity="unspecified")], } impact = bzutil.get_highest_impact(bugs, tracker_flaws_map) self.assertEqual(impact, "Low")
def test_lowest_to_highest_impact(self): trackers = [ flexmock(id=index, severity=severity) for index, severity in enumerate(constants.BUG_SEVERITY_NUMBER_MAP.keys()) ] tracker_flaws_map = {tracker.id: [] for tracker in trackers} impact = bzutil.get_highest_impact(trackers, tracker_flaws_map) self.assertEqual(impact, constants.SECURITY_IMPACT[4])
def test_single_impact(self): bugs = [] severity = "high" bugs.append(flexmock(severity=severity)) impact = bzutil.get_highest_impact(bugs, None) self.assertEqual( impact, constants.SECURITY_IMPACT[ constants.BUG_SEVERITY_NUMBER_MAP[severity]])