def test_init_working_dir():
"""init_working_dir should initialize a valid git repo, and clean up after itself"""
repo_url = "https://github.com/mitodl/release-script.git"
access_token = 'fake_access_token'
with patch('release.check_call', autospec=True) as check_call_mock, init_working_dir(
access_token, repo_url,
) as other_directory:
assert os.path.exists(other_directory)
assert not os.path.exists(other_directory)
calls = check_call_mock.call_args_list
assert [call[0][0] for call in calls] == [
['git', 'init'],
['git', 'remote', 'add', 'origin', url_with_access_token(access_token, repo_url)],
['git', 'fetch'],
['git', 'checkout', '-t', 'origin/master'],
]
评论列表
文章目录