def test__get_complexity_badge_Should_ReturnExpected_When_UseAverage( self, badge_patch, *patches): complexity_report = {'average': 79, 'highest': {'score': 50}} result = get_complexity_badge(complexity_report, use_average=True) self.assertEqual(result, badge_patch.return_value) badge_patch.assert_called_once_with('complexity', value='Unstable: 79', default_color='brightred')
def test__get_complexity_badge_Should_ReturnExpected_When_AlarmingRed( self, badge_patch, *patches): complexity_report = {'highest': {'score': 40}} result = get_complexity_badge(complexity_report) self.assertEqual(result, badge_patch.return_value) badge_patch.assert_called_once_with('complexity', value='Alarming: 40', default_color='red')
def test__get_complexity_badge_Should_ReturnExpected_When_ComplexOrange( self, badge_patch, *patches): complexity_report = {'highest': {'score': 30}} result = get_complexity_badge(complexity_report) self.assertEqual(result, badge_patch.return_value) badge_patch.assert_called_once_with('complexity', value='Complex: 30', default_color='orange')
def test__get_complexity_badge_Should_ReturnExpected_When_SlightYellow( self, badge_patch, *patches): complexity_report = {'highest': {'score': 20}} result = get_complexity_badge(complexity_report) self.assertEqual(result, badge_patch.return_value) badge_patch.assert_called_once_with('complexity', value='Slight: 20', default_color='yellow')
def test__get_complexity_badge_Should_ReturnExpected_When_StableGreen( self, badge_patch, *patches): complexity_report = {'highest': {'score': 10}} result = get_complexity_badge(complexity_report) self.assertEqual(result, badge_patch.return_value) badge_patch.assert_called_once_with('complexity', value='Stable: 10', default_color='olive')
def test__get_complexity_badge_Should_ReturnExpected_When_UseShields( self, badge_patch, *patches): complexity_report = {'highest': {'score': 5}} result = get_complexity_badge(complexity_report, use_shields=True) expected_result = 'https://img.shields.io/badge/complexity-Simple:%205-brightgreen' self.assertEqual(result, expected_result)