mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-17 04:30:30 +03:00
prettify write_yaml metadata
This commit is contained in:
parent
7aa92abebc
commit
f1e0089931
4 changed files with 215 additions and 44 deletions
|
|
@ -61,6 +61,27 @@ class RewritemetaTest(unittest.TestCase):
|
|||
self.maxDiff = None
|
||||
self.assertEqual(result.read(), orig.read())
|
||||
|
||||
def test_rewrite_yaml_special_build_params(self):
|
||||
|
||||
# setup/reset test dir if necessary and setup params
|
||||
tmpdir = os.path.join(os.path.dirname(__file__), '..', '.testfiles')
|
||||
if not os.path.exists(tmpdir):
|
||||
os.makedirs(tmpdir)
|
||||
testdir = tempfile.mkdtemp(prefix='test_rewrite_metadata_', dir=tmpdir)
|
||||
fdroidserver.common.config = {'accepted_formats': ['txt', 'yml']}
|
||||
|
||||
# rewrite metadata
|
||||
allapps = fdroidserver.metadata.read_metadata(xref=True)
|
||||
for appid, app in allapps.items():
|
||||
if appid == 'app.with.speacial.build.params':
|
||||
fdroidserver.metadata.write_metadata(os.path.join(testdir, appid + '.yml'), app)
|
||||
|
||||
# assert rewrite result
|
||||
with open(os.path.join(testdir, 'app.with.speacial.build.params.yml'), 'r', encoding='utf-8') as result:
|
||||
with open('metadata/rewrite-yml/app.with.speacial.build.params.yml', 'r', encoding='utf-8') as orig:
|
||||
self.maxDiff = None
|
||||
self.assertEqual(result.read(), orig.read())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = optparse.OptionParser()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue