mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-04 22:40:29 +03:00
rename parse_srclib to parese_txt_srclib + test case
This commit is contained in:
parent
0d42338d4d
commit
c6a97939f1
2 changed files with 28 additions and 3 deletions
|
|
@ -23,6 +23,8 @@ print('localmodule: ' + localmodule)
|
|||
if localmodule not in sys.path:
|
||||
sys.path.insert(0, localmodule)
|
||||
|
||||
from testcommon import TmpCwd
|
||||
|
||||
import fdroidserver.common
|
||||
import fdroidserver.metadata
|
||||
from fdroidserver.exception import MetaDataException
|
||||
|
|
@ -568,6 +570,29 @@ class MetadataTest(unittest.TestCase):
|
|||
UpdateCheckMode: None
|
||||
"""))
|
||||
|
||||
def test_parse_txt_srclib(self):
|
||||
with tempfile.TemporaryDirectory() as tmpdir, TmpCwd(tmpdir):
|
||||
with open('JSoup.txt', 'w', encoding='utf-8') as f:
|
||||
f.write(textwrap.dedent('''\
|
||||
# Source details (the only mandatory fields)
|
||||
Repo Type:git
|
||||
Repo:https://github.com/jhy/jsoup.git
|
||||
|
||||
# Comma-separated list of subdirs to use. The first existing subdirectory
|
||||
# found between those given will be used. If none is found or provided, the
|
||||
# root of the repo directory will be used instead.
|
||||
Subdir:
|
||||
|
||||
# Any extra commands to prepare the source library
|
||||
Prepare:
|
||||
'''))
|
||||
srclib = fdroidserver.metadata.parse_txt_srclib('JSoup.txt')
|
||||
self.assertDictEqual({'Repo': 'https://github.com/jhy/jsoup.git',
|
||||
'Repo Type': 'git',
|
||||
'Subdir': [''],
|
||||
'Prepare': ''},
|
||||
srclib)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
os.chdir(os.path.dirname(__file__))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue