From fa203572212b7b2f54fabe1d900aebe1d08f21a7 Mon Sep 17 00:00:00 2001 From: Jordan Petridis Date: Tue, 6 Nov 2018 15:48:55 +0200 Subject: [PATCH] build_manifest.py: remove get_hostname function Not really needed anymore now that it just calls urlparse. --- gitlab/build_manifest.py | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/gitlab/build_manifest.py b/gitlab/build_manifest.py index bb384677fd..9b1e208404 100755 --- a/gitlab/build_manifest.py +++ b/gitlab/build_manifest.py @@ -69,7 +69,8 @@ def preserve_ci_vars(func): def request_raw(path: str, headers: Dict[str, str], project_url: str) -> List[Dict[str, str]]: - base_url: str = get_hostname(project_url) + # ex. base_url = "gitlab.freedesktop.org" + base_url: str = urlparse(project_url).hostname url: str = f"https://{base_url}/api/v4/{path}" print(f"GET {url}") print(f"Headers: {headers}") @@ -177,18 +178,6 @@ def test_search_user_namespace(): assert res is None -def get_hostname(url: str) -> str: - return urlparse(url).hostname - - -def test_get_hostname(): - gitlab = 'https://gitlab.com/example/a_project' - assert get_hostname(gitlab) == 'gitlab.com' - - fdo = 'https://gitlab.freedesktop.org/example/a_project' - assert get_hostname(fdo) == 'gitlab.freedesktop.org' - - def find_repository_sha(module: Tuple[str, int], branchname: str) -> Tuple[str, str]: user_login: str = os.environ["GITLAB_USER_LOGIN"] project = search_user_namespace(user_login, module[0])