mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-13 14:32:28 +03:00
split out mirrors data structure into standalone, tested function
This commit is contained in:
parent
9749282b44
commit
cff3364fdf
2 changed files with 36 additions and 17 deletions
|
@ -12,6 +12,7 @@ import logging
|
|||
import optparse
|
||||
import os
|
||||
import re
|
||||
import ruamel.yaml
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
|
@ -2892,6 +2893,27 @@ class CommonTest(unittest.TestCase):
|
|||
fdroidserver.common.read_config()['serverwebroot'],
|
||||
)
|
||||
|
||||
def test_parse_mirrors_config_str(self):
|
||||
s = 'foo@example.com:/var/www'
|
||||
mirrors = ruamel.yaml.YAML(typ='safe').load("""'%s'""" % s)
|
||||
self.assertEqual(
|
||||
[{'url': s}], fdroidserver.common.parse_mirrors_config(mirrors)
|
||||
)
|
||||
|
||||
def test_parse_mirrors_config_list(self):
|
||||
s = 'foo@example.com:/var/www'
|
||||
mirrors = ruamel.yaml.YAML(typ='safe').load("""- '%s'""" % s)
|
||||
self.assertEqual(
|
||||
[{'url': s}], fdroidserver.common.parse_mirrors_config(mirrors)
|
||||
)
|
||||
|
||||
def test_parse_mirrors_config_dict(self):
|
||||
s = 'foo@example.com:/var/www'
|
||||
mirrors = ruamel.yaml.YAML(typ='safe').load("""- url: '%s'""" % s)
|
||||
self.assertEqual(
|
||||
[{'url': s}], fdroidserver.common.parse_mirrors_config(mirrors)
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
os.chdir(os.path.dirname(__file__))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue