def test_update_code_new_target(mock_remote_core, tmpdir): remote_core.cmd.side_effect = [('', ''), ('', ''), ('', ''), ('', '')] remote_core.ensure_repository(str(tmpdir) + '/foo', 'hg-bundle') remote_core.hg_pull_code('http://bitbucket.org/flyingcircus/batou') remote_core.hg_update_working_copy('default') assert remote_core.cmd.call_count == 4 calls = iter(x[1][0] for x in remote_core.cmd.mock_calls) assert next(calls) == 'hg init {}'.format(remote_core.target_directory) assert next(calls) == 'hg pull http://bitbucket.org/flyingcircus/batou' assert next(calls) == 'hg up -C default' assert next(calls) == 'hg id -i'
def test_update_code_new_target(mock_remote_core, tmpdir): remote_core.cmd.side_effect = [("", ""), ("", ""), ("", ""), ("", "")] remote_core.ensure_repository(str(tmpdir) + "/foo", "hg-bundle") remote_core.hg_pull_code("http://bitbucket.org/flyingcircus/batou") remote_core.hg_update_working_copy("default") assert remote_core.cmd.call_count == 4 calls = iter(x[1][0] for x in remote_core.cmd.mock_calls) assert next(calls) == "hg init {}".format(remote_core.target_directory) assert next(calls) == "hg pull http://bitbucket.org/flyingcircus/batou" assert next(calls) == "hg up -C default" assert next(calls) == "hg id -i"
def test_update_code_existing_target(mock_remote_core, tmpdir): remote_core.cmd.side_effect = [('', ''), ('', ''), ('', ''), ('', '')] remote_core.ensure_repository(str(tmpdir), 'hg-pull') remote_core.hg_pull_code('http://bitbucket.org/flyingcircus/batou') remote_core.hg_update_working_copy('default') calls = iter(x[1][0] for x in remote_core.cmd.mock_calls) assert next(calls).startswith('hg init /') assert next(calls) == 'hg pull http://bitbucket.org/flyingcircus/batou' assert next(calls) == 'hg up -C default' assert next(calls) == 'hg id -i' assert remote_core.cmd.call_count == 4
def test_update_code_existing_target(mock_remote_core, tmpdir): remote_core.cmd.side_effect = [("", ""), ("", ""), ("", ""), ("", "")] remote_core.ensure_repository(str(tmpdir), "hg-pull") remote_core.hg_pull_code("http://bitbucket.org/flyingcircus/batou") remote_core.hg_update_working_copy("default") calls = iter(x[1][0] for x in remote_core.cmd.mock_calls) assert next(calls).startswith("hg init /") assert next(calls) == "hg pull http://bitbucket.org/flyingcircus/batou" assert next(calls) == "hg up -C default" assert next(calls) == "hg id -i" assert remote_core.cmd.call_count == 4