Exemplo n.º 1
0
def test_github_ref():
    provider = GitHubRepoProvider(spec='jupyterhub/zero-to-jupyterhub-k8s/v0.4')
    slug = provider.get_build_slug()
    assert slug == 'jupyterhub-zero-to-jupyterhub-k8s'
    full_url = provider.get_repo_url()
    assert full_url == 'https://github.com/jupyterhub/zero-to-jupyterhub-k8s'
    ref = IOLoop().run_sync(provider.get_resolved_ref)
    assert ref == 'f7f3ff6d1bf708bdc12e5f10e18b2a90a4795603'
Exemplo n.º 2
0
def test_github_ref():
    namespace = 'jupyterhub/zero-to-jupyterhub-k8s'
    spec = f'{namespace}/v0.4'
    provider = GitHubRepoProvider(spec=spec)
    slug = provider.get_build_slug()
    assert slug == 'jupyterhub-zero-to-jupyterhub-k8s'
    full_url = provider.get_repo_url()
    assert full_url == f'https://github.com/{namespace}'
    ref = IOLoop().run_sync(provider.get_resolved_ref)
    assert ref == 'f7f3ff6d1bf708bdc12e5f10e18b2a90a4795603'
    ref_url = IOLoop().run_sync(provider.get_resolved_ref_url)
    assert ref_url == f'https://github.com/{namespace}/tree/{ref}'
    resolved_spec = IOLoop().run_sync(provider.get_resolved_spec)
    assert resolved_spec == f'{namespace}/{ref}'
Exemplo n.º 3
0
def test_github_ref(repo, unresolved_ref, resolved_ref):
    spec = f"{repo}/{unresolved_ref}"
    provider = GitHubRepoProvider(spec=spec)
    slug = provider.get_build_slug()
    assert slug == repo.replace("/", "-")
    full_url = provider.get_repo_url()
    assert full_url == f"https://github.com/{repo}"
    ref = IOLoop().run_sync(provider.get_resolved_ref)
    if resolved_ref is True:
        # True means it should resolve, but don't check value
        assert ref is not None
        assert is_valid_sha1(ref)
    else:
        assert ref == resolved_ref
    if not resolved_ref:
        # we are done here if we don't expect to resolve
        return
    ref_url = IOLoop().run_sync(provider.get_resolved_ref_url)
    assert ref_url == f"https://github.com/{repo}/tree/{ref}"
    resolved_spec = IOLoop().run_sync(provider.get_resolved_spec)
    assert resolved_spec == f"{repo}/{ref}"