build_manifest.py: remove get_hostname function

Not really needed anymore now that it just calls urlparse.
This commit is contained in:
Jordan Petridis 2018-11-06 15:48:55 +02:00
parent 9d637f6694
commit fa20357221
No known key found for this signature in database
GPG key ID: 902CC06D159744F5

View file

@ -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])