def test_returns_none_when_there_are_no_previous_good_builds(self): with mock.patch('releases.Jenkins') as Jenkins: job = mock.Mock() job.get_last_good_build.return_value.get_revision.side_effect = NoBuildData Jenkins.return_value.__getitem__.side_effect = lambda k: job assert get_last_good_revision('url', 'job') is None
def test_gets_last_good_revision_from_jenkins(self): with mock.patch('releases.Jenkins') as Jenkins: job = mock.Mock() job.get_last_good_build.return_value.get_revision.return_value = 'abcde' Jenkins.return_value.__getitem__.side_effect = lambda k: job assert get_last_good_revision('url', 'job') == 'abcde'