Adding upstream version 0.12.9.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
3ac0de4543
commit
d01d7be95b
8 changed files with 252 additions and 91 deletions
|
@ -43,7 +43,7 @@ class TestLsLl:
|
|||
assert info.Color.end in out
|
||||
|
||||
# no color on branch name
|
||||
__main__.main(['ll', '-n'])
|
||||
__main__.main(['ll', '-C'])
|
||||
out, err = capfd.readouterr()
|
||||
assert err == ''
|
||||
assert 'gita' in out
|
||||
|
@ -95,6 +95,16 @@ class TestLsLl:
|
|||
assert out == expected
|
||||
|
||||
|
||||
@patch('subprocess.run')
|
||||
@patch('gita.utils.get_repos', return_value={'repo1': '/a/', 'repo2': '/b/'})
|
||||
def test_freeze(_, mock_run, capfd):
|
||||
__main__.main(['freeze'])
|
||||
assert mock_run.call_count == 2
|
||||
out, err = capfd.readouterr()
|
||||
assert err == ''
|
||||
assert out == ',repo1,/a/\n,repo2,/b/\n'
|
||||
|
||||
|
||||
@patch('os.path.isfile', return_value=True)
|
||||
@patch('gita.common.get_config_fname', return_value='some path')
|
||||
@patch('gita.utils.get_repos', return_value={'repo1': '/a/', 'repo2': '/b/'})
|
||||
|
@ -149,6 +159,20 @@ def test_superman(mock_run, _, input):
|
|||
mock_run.assert_called_once_with(expected_cmds, cwd='path7')
|
||||
|
||||
|
||||
@pytest.mark.parametrize('input', [
|
||||
'diff --name-only --staged',
|
||||
"commit -am 'lala kaka'",
|
||||
])
|
||||
@patch('gita.utils.get_repos', return_value={'repo7': 'path7'})
|
||||
@patch('subprocess.run')
|
||||
def test_shell(mock_run, _, input):
|
||||
mock_run.reset_mock()
|
||||
args = ['shell', 'repo7'] + shlex.split(input)
|
||||
__main__.main(args)
|
||||
expected_cmds = shlex.split(input)
|
||||
mock_run.assert_called_once_with(expected_cmds, cwd='path7', check=True, stderr=-2, stdout=-1)
|
||||
|
||||
|
||||
class TestContext:
|
||||
|
||||
@patch('gita.utils.get_context', return_value=None)
|
||||
|
@ -273,6 +297,19 @@ class TestGroupCmd:
|
|||
mock_write.assert_called_once_with(
|
||||
{'xx': ['a', 'b', 'c'], 'yy': ['a', 'c', 'd']}, 'w')
|
||||
|
||||
@patch('gita.utils.get_repos', return_value={'a': '', 'b': '', 'c': '', 'd': ''})
|
||||
@patch('gita.common.get_config_fname', return_value=GROUP_FNAME)
|
||||
@patch('gita.utils.write_to_groups_file')
|
||||
def testRmRepo(self, mock_write, *_):
|
||||
args = argparse.Namespace()
|
||||
args.from_group = ['a', 'c']
|
||||
args.group_cmd = 'rmrepo'
|
||||
args.gname = 'xx'
|
||||
utils.get_groups.cache_clear()
|
||||
__main__.f_group(args)
|
||||
mock_write.assert_called_once_with(
|
||||
{'xx': ['b'], 'yy': ['a', 'c', 'd']}, 'w')
|
||||
|
||||
|
||||
@patch('gita.utils.is_git', return_value=True)
|
||||
@patch('gita.common.get_config_fname', return_value=PATH_FNAME)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue