Ejemplo n.º 1
0
def test_check_out_non_existing_file(mock_git_repo, tmpdir):
    git_url = "https://localhost/git"
    repo_name = "foo"

    with mock_git_repo(tmpdir, repo_name, git_url):
        git_con = GitConnection(git_url, workspace=tmpdir)
        git_repo = GitRepository(repo_name, git_con)

        with pytest.raises(CheckoutError) as excinfo:
            git_repo.check_out_file("non-existing-file")
        assert "Failed to check out 'non-existing-file'" in str(excinfo.value)
Ejemplo n.º 2
0
def test_check_out_file(mock_git_repo, tmpdir):
    git_url = "https://localhost/git"
    repo_name = "foo"

    with mock_git_repo(tmpdir, repo_name, git_url):
        git_con = GitConnection(git_url, workspace=tmpdir)
        git_repo = GitRepository(repo_name, git_con)

        contents = git_repo.check_out_file("README")
        assert contents == "Repository: foo"