| Index: tests/git_drover_test.py
|
| diff --git a/tests/git_drover_test.py b/tests/git_drover_test.py
|
| index 98f9352ede1da63b01b8a2d0e660c4d96484c194..ea38df6006dc4c3e9c884fc4b90b219987469ba4 100755
|
| --- a/tests/git_drover_test.py
|
| +++ b/tests/git_drover_test.py
|
| @@ -37,6 +37,8 @@ class GitDroverTest(auto_stub.TestCase):
|
| self.mock(__builtins__, 'raw_input', self._get_input)
|
| self.mock(subprocess, 'check_call', self._check_call)
|
| self.mock(subprocess, 'check_output', self._check_call)
|
| + self.real_popen = subprocess.Popen
|
| + self.mock(subprocess, 'Popen', self._Popen)
|
| self._commands = []
|
| self._input = []
|
| self._fail_on_command = None
|
| @@ -75,7 +77,7 @@ class GitDroverTest(auto_stub.TestCase):
|
| ]
|
| self.MANUAL_RESOLVE_PREPARATION_COMMANDS = [
|
| (['git', 'status', '--porcelain'], self._target_repo),
|
| - (['git', 'update-index', '--skip-worktree', '--', 'foo', 'bar'],
|
| + (['git', 'update-index', '--skip-worktree', '--stdin'],
|
| self._target_repo),
|
| ]
|
| self.FINISH_MANUAL_RESOLVE_COMMANDS = [
|
| @@ -113,6 +115,25 @@ class GitDroverTest(auto_stub.TestCase):
|
| return ' D foo\nUU baz\n D bar\n'
|
| return ''
|
|
|
| + def _Popen(self, args, shell=False, cwd=None, stdin=None, stdout=None,
|
| + stderr=None):
|
| + if args == ['git', 'update-index', '--skip-worktree', '--stdin']:
|
| + self._commands.append((args, cwd))
|
| + self.assertFalse(shell)
|
| + self.assertEqual(stdin, subprocess.PIPE)
|
| + class MockPopen(object):
|
| + def __init__(self, *args, **kwargs):
|
| + self.returncode = -999
|
| + def communicate(self, stdin):
|
| + if stdin == 'foo\nbar\n':
|
| + self.returncode = 0
|
| + else:
|
| + self.returncode = 1
|
| + return MockPopen()
|
| + else:
|
| + return self.real_popen(args, shell=shell, cwd=cwd, stdin=stdin,
|
| + stdout=stdout, stderr=stderr)
|
| +
|
| def testSuccess(self):
|
| self._input = ['y', 'y']
|
| git_drover.cherry_pick_change('branch', 'cl', self._parent_repo, False)
|
|
|