def test_parse_github_repository_success():
    protocol, repository = cmn.parse_github_repository(
        "https://github.com/peter-evans/create-pull-request")
    assert protocol == "HTTPS"
    assert repository == "peter-evans/create-pull-request"

    protocol, repository = cmn.parse_github_repository(
        "[email protected]:peter-evans/create-pull-request.git")
    assert protocol == "SSH"
    assert repository == "peter-evans/create-pull-request"
def get_repository_detail(repo):
    remote_origin_url = get_git_config_value(repo, "remote.origin.url")
    if remote_origin_url is None:
        raise ValueError("Failed to fetch 'remote.origin.url' from git config")
    protocol, github_repository = cmn.parse_github_repository(
        remote_origin_url)
    return remote_origin_url, protocol, github_repository
Exemple #3
0
def test_parse_github_repository_failure():
    url = "https://github.com/peter-evans"
    with pytest.raises(ValueError) as e_info:
        cmn.parse_github_repository(url)
    assert (e_info.value.args[0] ==
            f"The format of '{url}' is not a valid GitHub repository URL")