def test_gitlab_ref(): spec = '{}/{}'.format(quote('gitlab-org/gitlab-ce', safe=''), quote('v10.0.6')) provider = GitLabRepoProvider(spec=spec) slug = provider.get_build_slug() assert slug == 'gitlab_-org-gitlab_-ce' full_url = provider.get_repo_url() assert full_url == 'https://gitlab.com/gitlab-org/gitlab-ce.git' ref = IOLoop().run_sync(provider.get_resolved_ref) assert ref == 'b3344b7f17c335a817c5d7608c5e47fd7cabc023'
def test_gitlab_ref(): namespace = 'gitlab-org/gitlab-foss' spec = '{}/{}'.format(quote(namespace, safe=''), quote('v10.0.6')) provider = GitLabRepoProvider(spec=spec) slug = provider.get_build_slug() assert slug == 'gitlab_-org-gitlab_-foss' full_url = provider.get_repo_url() assert full_url == f'https://gitlab.com/{namespace}.git' ref = IOLoop().run_sync(provider.get_resolved_ref) assert ref == 'b3344b7f17c335a817c5d7608c5e47fd7cabc023' ref_url = IOLoop().run_sync(provider.get_resolved_ref_url) assert ref_url == f'https://gitlab.com/{namespace}/tree/{ref}' resolved_spec = IOLoop().run_sync(provider.get_resolved_spec) assert resolved_spec == quote(namespace, safe='') + f'/{ref}'
def test_gitlab_ref(unresolved_ref, resolved_ref): namespace = "gitlab-org/gitlab-foss" spec = "{}/{}".format(quote(namespace, safe=""), quote(unresolved_ref)) provider = GitLabRepoProvider(spec=spec) slug = provider.get_build_slug() assert slug == 'gitlab_-org-gitlab_-foss' full_url = provider.get_repo_url() assert full_url == f'https://gitlab.com/{namespace}.git' 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://gitlab.com/{namespace}/tree/{ref}' resolved_spec = IOLoop().run_sync(provider.get_resolved_spec) assert resolved_spec == quote(namespace, safe='') + f'/{ref}'