def test_other_branch(self): repo = mock.Mock(**{ 'get_current_branch.return_value': 'other', }) output = mock.Mock() with freshen.with_branch(output, repo, 'master'): repo.get_current_branch.assert_called_once_with() output.send.assert_called_once_with(mock.ANY) repo.git_checkout.assert_called_once_with(output, 'master') output.reset_mock() repo.reset_mock() output.send.assert_called_once_with(mock.ANY) repo.git_checkout.assert_called_once_with(output, 'other')
def test_same_branch(self): repo = mock.Mock(**{ 'get_current_branch.return_value': 'master', }) output = mock.Mock() with freshen.with_branch(output, repo, 'master'): repo.get_current_branch.assert_called_once_with() self.assertFalse(output.send.called) self.assertFalse(repo.git_checkout.called) output.reset_mock() repo.reset_mock() self.assertFalse(output.send.called) self.assertFalse(repo.git_checkout.called)