mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-13 22:42:29 +03:00
Merge branch 'fix_ci' into 'master'
Fix get_dir_size call See merge request fdroid/fdroidserver!1015
This commit is contained in:
commit
5b9fd12150
2 changed files with 27 additions and 22 deletions
|
@ -1038,7 +1038,7 @@ def get_mirror_service_urls(url):
|
||||||
segments.extend([branch, folder])
|
segments.extend([branch, folder])
|
||||||
urls.append('/'.join(segments))
|
urls.append('/'.join(segments))
|
||||||
elif hostname == "gitlab.com":
|
elif hostname == "gitlab.com":
|
||||||
if common.get_dir_size() <= common.GITLAB_COM_PAGES_MAX_SIZE:
|
if common.get_dir_size(folder) <= common.GITLAB_COM_PAGES_MAX_SIZE:
|
||||||
# Gitlab-like Pages segments "https://user.gitlab.io/repo/folder"
|
# Gitlab-like Pages segments "https://user.gitlab.io/repo/folder"
|
||||||
gitlab_pages = ["https:", "", user + ".gitlab.io", repo, folder]
|
gitlab_pages = ["https:", "", user + ".gitlab.io", repo, folder]
|
||||||
urls.append('/'.join(gitlab_pages))
|
urls.append('/'.join(gitlab_pages))
|
||||||
|
|
|
@ -27,6 +27,7 @@ import fdroidserver.net
|
||||||
import fdroidserver.signindex
|
import fdroidserver.signindex
|
||||||
import fdroidserver.publish
|
import fdroidserver.publish
|
||||||
from testcommon import TmpCwd
|
from testcommon import TmpCwd
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
GP_FINGERPRINT = 'B7C2EEFD8DAC7806AF67DFCD92EB18126BC08312A7F2D6F3862E46013C7A6135'
|
GP_FINGERPRINT = 'B7C2EEFD8DAC7806AF67DFCD92EB18126BC08312A7F2D6F3862E46013C7A6135'
|
||||||
|
@ -371,13 +372,17 @@ class IndexTest(unittest.TestCase):
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_gitlab_get_mirror_service_urls(self):
|
def test_gitlab_get_mirror_service_urls(self):
|
||||||
|
with tempfile.TemporaryDirectory() as tmpdir, TmpCwd(tmpdir):
|
||||||
|
os.mkdir('fdroid')
|
||||||
|
with Path('fdroid/placeholder').open('w') as fp:
|
||||||
|
fp.write(' ')
|
||||||
for url in [
|
for url in [
|
||||||
'git@gitlab.com:group/project',
|
'git@gitlab.com:group/project',
|
||||||
'git@gitlab.com:group/project.git',
|
'git@gitlab.com:group/project.git',
|
||||||
'https://gitlab.com/group/project',
|
'https://gitlab.com/group/project',
|
||||||
'https://gitlab.com/group/project.git',
|
'https://gitlab.com/group/project.git',
|
||||||
]:
|
]:
|
||||||
with patch('fdroidserver.common.get_dir_size', return_value=100000):
|
with patch('fdroidserver.common.GITLAB_COM_PAGES_MAX_SIZE', 1000):
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
[
|
[
|
||||||
'https://group.gitlab.io/project/fdroid',
|
'https://group.gitlab.io/project/fdroid',
|
||||||
|
@ -385,7 +390,7 @@ class IndexTest(unittest.TestCase):
|
||||||
],
|
],
|
||||||
fdroidserver.index.get_mirror_service_urls(url),
|
fdroidserver.index.get_mirror_service_urls(url),
|
||||||
)
|
)
|
||||||
with patch('fdroidserver.common.get_dir_size', return_value=1234567890):
|
with patch('fdroidserver.common.GITLAB_COM_PAGES_MAX_SIZE', 10):
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
[
|
[
|
||||||
'https://gitlab.com/group/project/-/raw/master/fdroid',
|
'https://gitlab.com/group/project/-/raw/master/fdroid',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue