コード例 #1
0
def test_parse_ref_from_git_repo():
    """Get working_dir from git_repo"""
    project = LocalProject(
        git_repo=flexmock(active_branch="branch", head=flexmock(is_detached=False)),
        refresh=False,
    )
    changed = project._parse_ref_from_git_repo()

    assert changed
    assert project.git_repo
    assert project._ref == "branch"
コード例 #2
0
def test_parse_ref_from_git_repo_detached():
    project = LocalProject(
        git_repo=flexmock(
            active_branch="branch",
            head=flexmock(is_detached=True, commit=flexmock(hexsha="sha")),
        ),
        refresh=False,
    )
    changed = project._parse_ref_from_git_repo()

    assert changed
    assert project.git_repo
    assert project._ref == "sha"