mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-04 06:30:27 +03:00
clarify config data types and structures
This commit is contained in:
parent
081e02c109
commit
8cf1297e2c
5 changed files with 116 additions and 31 deletions
|
|
@ -2903,46 +2903,46 @@ class CommonTest(unittest.TestCase):
|
|||
with self.assertRaises(TypeError):
|
||||
fdroidserver.common.expand_env_dict({'env': 'foo', 'foo': 'bar'})
|
||||
|
||||
def test_parse_mirrors_config_str(self):
|
||||
def test_parse_list_of_dicts_str(self):
|
||||
s = 'foo@example.com:/var/www'
|
||||
mirrors = yaml.load("""'%s'""" % s)
|
||||
self.assertEqual(
|
||||
[{'url': s}], fdroidserver.common.parse_mirrors_config(mirrors)
|
||||
[{'url': s}], fdroidserver.common.parse_list_of_dicts(mirrors)
|
||||
)
|
||||
|
||||
def test_parse_mirrors_config_list(self):
|
||||
def test_parse_list_of_dicts_list(self):
|
||||
s = 'foo@example.com:/var/www'
|
||||
mirrors = yaml.load("""- '%s'""" % s)
|
||||
self.assertEqual(
|
||||
[{'url': s}], fdroidserver.common.parse_mirrors_config(mirrors)
|
||||
[{'url': s}], fdroidserver.common.parse_list_of_dicts(mirrors)
|
||||
)
|
||||
|
||||
def test_parse_mirrors_config_dict(self):
|
||||
def test_parse_list_of_dicts_dict(self):
|
||||
s = 'foo@example.com:/var/www'
|
||||
mirrors = yaml.load("""- url: '%s'""" % s)
|
||||
self.assertEqual(
|
||||
[{'url': s}], fdroidserver.common.parse_mirrors_config(mirrors)
|
||||
[{'url': s}], fdroidserver.common.parse_list_of_dicts(mirrors)
|
||||
)
|
||||
|
||||
@mock.patch.dict(os.environ, {'PATH': os.getenv('PATH'), 'foo': 'bar'}, clear=True)
|
||||
def test_parse_mirrors_config_env_str(self):
|
||||
def test_parse_list_of_dicts_env_str(self):
|
||||
mirrors = yaml.load('{env: foo}')
|
||||
self.assertEqual(
|
||||
[{'url': 'bar'}], fdroidserver.common.parse_mirrors_config(mirrors)
|
||||
[{'url': 'bar'}], fdroidserver.common.parse_list_of_dicts(mirrors)
|
||||
)
|
||||
|
||||
def test_parse_mirrors_config_env_list(self):
|
||||
def test_parse_list_of_dicts_env_list(self):
|
||||
s = 'foo@example.com:/var/www'
|
||||
mirrors = yaml.load("""- '%s'""" % s)
|
||||
self.assertEqual(
|
||||
[{'url': s}], fdroidserver.common.parse_mirrors_config(mirrors)
|
||||
[{'url': s}], fdroidserver.common.parse_list_of_dicts(mirrors)
|
||||
)
|
||||
|
||||
def test_parse_mirrors_config_env_dict(self):
|
||||
def test_parse_list_of_dicts_env_dict(self):
|
||||
s = 'foo@example.com:/var/www'
|
||||
mirrors = yaml.load("""- url: '%s'""" % s)
|
||||
self.assertEqual(
|
||||
[{'url': s}], fdroidserver.common.parse_mirrors_config(mirrors)
|
||||
[{'url': s}], fdroidserver.common.parse_list_of_dicts(mirrors)
|
||||
)
|
||||
|
||||
def test_KnownApks_recordapk(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue