def test_noop(self): with patch('gaia_uplift.git.cherry_pick') as cherry_pick: commit = 'abc123' cherry_pick.return_value = commit actual = subject.uplift_commit(None, commit, ['v1']) expected = { 'success': {'v1': commit}, 'failure': [] } self.assertEqual(expected, actual)
def test_success_two_branches(self): with patch('gaia_uplift.git.cherry_pick') as cherry_pick: branches = ['v1', 'v2'] cherry_pick.side_effect = ["%ssha" % x for x in branches] actual = subject.uplift_commit(None, 'commit', branches) expected = { 'success': {'v1': 'v1sha', 'v2': 'v2sha'}, 'failure': [] } self.assertEqual(expected, actual)
def test_failure_two_branches(self): with patch('gaia_uplift.git.cherry_pick') as cherry_pick: branches = ['v1', 'v2'] cherry_pick.side_effect = [git.GitError, git.GitError] actual = subject.uplift_commit(None, 'commit', branches) expected = { 'success': {}, 'failure': ['v1', 'v2'] } self.assertEqual(expected, actual)