diff --git a/soufi/finders/centos.py b/soufi/finders/centos.py index 02eee2a..6b740b0 100644 --- a/soufi/finders/centos.py +++ b/soufi/finders/centos.py @@ -94,12 +94,12 @@ def get_source_repos(self): """ for dir in self._get_dirs(): for subdir in self.repos: - url = f"{VAULT}/{dir}/{subdir}/Source/" + url = f"{VAULT.rstrip('/')}/{dir}/{subdir}/Source/" if self.test_url(url + "repodata/"): yield url if self.optimal_repos: for subdir in OPTIMAL_SEARCH: - url = f"{VAULT}/{dir}/{subdir}/Source/" + url = f"{VAULT.rstrip('/')}/{dir}/{subdir}/Source/" if self.test_url(url + "repodata/"): yield url @@ -112,8 +112,8 @@ def get_binary_repos(self): """ def _find_valid_repo_url(dir, subdir): - vault_url = f"{VAULT}/{dir}/{subdir}/x86_64/" - mirror_url = f"{MIRROR}/{dir}/{subdir}/x86_64/" + vault_url = f"{VAULT.rstrip('/')}/{dir}/{subdir}/x86_64/" + mirror_url = f"{MIRROR.rstrip('/')}/{dir}/{subdir}/x86_64/" for url in vault_url, mirror_url: if self.test_url(url + "os/repodata/"): yield url + "os/" diff --git a/soufi/tests/finders/test_centos_finder.py b/soufi/tests/finders/test_centos_finder.py index 0a3f385..74fea2c 100644 --- a/soufi/tests/finders/test_centos_finder.py +++ b/soufi/tests/finders/test_centos_finder.py @@ -70,7 +70,7 @@ def test__get_source_repos(self): test_url.return_value = True result = list(finder.get_source_repos()) expected = [ - f"{centos.VAULT}/{dir}/{subdir}/Source/" + f"{centos.VAULT}{dir}/{subdir}/Source/" for dir in dirs for subdir in subdirs ] @@ -86,7 +86,7 @@ def test__get_source_repos_optimal(self): test_url.return_value = True result = list(finder.get_source_repos()) expected = [ - f"{centos.VAULT}/{dir}/{subdir}/Source/" + f"{centos.VAULT}{dir}/{subdir}/Source/" for dir in dirs for subdir in (centos.DEFAULT_SEARCH + centos.OPTIMAL_SEARCH) ] @@ -102,7 +102,7 @@ def test__get_binary_repos(self): test_url.return_value = True result = list(finder.get_binary_repos()) expected = [ - f"{centos.VAULT}/{dir}/{subdir}/x86_64/os/" + f"{centos.VAULT}{dir}/{subdir}/x86_64/os/" for dir in dirs for subdir in subdirs ] @@ -118,7 +118,7 @@ def test__get_binary_repos_old_style(self): test_url.side_effect = itertools.cycle((False, True)) result = list(finder.get_binary_repos()) expected = [ - f"{centos.VAULT}/{dir}/{subdir}/x86_64/" + f"{centos.VAULT}{dir}/{subdir}/x86_64/" for dir in dirs for subdir in subdirs ] @@ -134,7 +134,7 @@ def test__get_binary_repos_using_mirror(self): test_url.side_effect = itertools.cycle((False, False, True)) result = list(finder.get_binary_repos()) expected = [ - f"{centos.MIRROR}/{dir}/{subdir}/x86_64/os/" + f"{centos.MIRROR}{dir}/{subdir}/x86_64/os/" for dir in dirs for subdir in subdirs ] @@ -150,7 +150,7 @@ def test__get_binary_repos_old_style_using_mirror(self): test_url.side_effect = itertools.cycle((False, False, False, True)) result = list(finder.get_binary_repos()) expected = [ - f"{centos.MIRROR}/{dir}/{subdir}/x86_64/" + f"{centos.MIRROR}{dir}/{subdir}/x86_64/" for dir in dirs for subdir in subdirs ] @@ -166,7 +166,7 @@ def test__get_binary_repos_optimal(self): test_url.return_value = True result = list(finder.get_binary_repos()) expected = [ - f"{centos.VAULT}/{dir}/{subdir}/x86_64/os/" + f"{centos.VAULT}{dir}/{subdir}/x86_64/os/" for dir in dirs for subdir in (centos.DEFAULT_SEARCH + centos.OPTIMAL_SEARCH) ] @@ -182,7 +182,7 @@ def test__get_binary_repos_optimal_old_style(self): test_url.side_effect = itertools.cycle((False, True)) result = list(finder.get_binary_repos()) expected = [ - f"{centos.VAULT}/{dir}/{subdir}/x86_64/" + f"{centos.VAULT}{dir}/{subdir}/x86_64/" for dir in dirs for subdir in (centos.DEFAULT_SEARCH + centos.OPTIMAL_SEARCH) ] @@ -198,7 +198,7 @@ def test__get_binary_repos_optimal_using_mirror(self): test_url.side_effect = itertools.cycle((False, False, True)) result = list(finder.get_binary_repos()) expected = [ - f"{centos.MIRROR}/{dir}/{subdir}/x86_64/os/" + f"{centos.MIRROR}{dir}/{subdir}/x86_64/os/" for dir in dirs for subdir in (centos.DEFAULT_SEARCH + centos.OPTIMAL_SEARCH) ] @@ -214,7 +214,7 @@ def test__get_binary_repos_optimal_old_style_using_mirror(self): test_url.side_effect = itertools.cycle((False, False, False, True)) result = list(finder.get_binary_repos()) expected = [ - f"{centos.MIRROR}/{dir}/{subdir}/x86_64/" + f"{centos.MIRROR}{dir}/{subdir}/x86_64/" for dir in dirs for subdir in (centos.DEFAULT_SEARCH + centos.OPTIMAL_SEARCH) ]