git_mirror_size_limit config option to set max git mirror size

GitHub and GitLab have some kinds of limits on how big a git repo can be,
this makes that option configurable.  This also is very useful for tests.
This commit is contained in:
Hans-Christoph Steiner 2020-01-13 11:48:23 +01:00
parent 4fa11ef4fc
commit e76a0c9d6a
No known key found for this signature in database
GPG key ID: 3E177817BA1B9BFA
5 changed files with 100 additions and 4 deletions

View file

@ -45,6 +45,15 @@ class CommonTest(unittest.TestCase):
os.makedirs(self.tmpdir)
os.chdir(self.basedir)
def test_parse_human_readable_size(self):
for k, v in ((9827, 9827), (123.456, 123), ('123b', 123), ('1.2', 1),
('10.43 KiB', 10680), ('11GB', 11000000000), ('59kb', 59000),
('343.1 mb', 343100000), ('99.9GiB', 107266808217)):
self.assertEqual(fdroidserver.common.parse_human_readable_size(k), v)
for v in ((12, 123), '0xfff', [], None, '12,123', '123GG', '982374bb', self):
with self.assertRaises(ValueError):
fdroidserver.common.parse_human_readable_size(v)
def test_assert_config_keystore(self):
with tempfile.TemporaryDirectory() as tmpdir, TmpCwd(tmpdir):
with self.assertRaises(FDroidException):