update: parse Triple-T v2.x layout

Thanks to the very nice example from Piwigo, included here under the GPLv3+
https://github.com/Piwigo/Piwigo-Android

https://gitlab.com/fdroid/fdroiddata/merge_requests/5579#note_225834868
This commit is contained in:
Hans-Christoph Steiner 2019-10-04 11:06:42 +02:00
parent a7dd7a812f
commit 5904aef5a7
No known key found for this signature in database
GPG key ID: 3E177817BA1B9BFA
37 changed files with 442 additions and 1 deletions

View file

@ -193,6 +193,47 @@ class UpdateTest(unittest.TestCase):
locales = sorted(list(apps['org.fdroid.ci.test.app']['localized'].keys()))
self.assertEqual(correctlocales, locales)
def test_insert_triple_t_2_metadata(self):
packageName = 'org.piwigo.android'
tmptestsdir = tempfile.mkdtemp(prefix=inspect.currentframe().f_code.co_name,
dir=self.tmpdir)
os.rmdir(tmptestsdir)
shutil.copytree(os.path.join(self.basedir, 'triple-t-2'), tmptestsdir)
os.chdir(tmptestsdir)
config = dict()
fdroidserver.common.fill_config_defaults(config)
config['accepted_formats'] = ('yml')
fdroidserver.common.config = config
fdroidserver.update.config = config
fdroidserver.update.options = fdroidserver.common.options
apps = fdroidserver.metadata.read_metadata(xref=True)
self.assertTrue(packageName in apps)
fdroidserver.update.copy_triple_t_store_metadata(apps)
correctlocales = ['de-DE', 'en-US', 'fr-FR', 'kn-IN']
app = apps[packageName]
self.assertEqual('android@piwigo.org', app['authorEmail'])
self.assertEqual('https://www.piwigo.org', app['authorWebSite'])
locales = sorted(list(app['localized'].keys()))
self.assertEqual(correctlocales, locales)
kn_IN = app['localized']['kn-IN']
self.assertTrue('description' in kn_IN)
self.assertTrue('name' in kn_IN)
self.assertTrue('summary' in kn_IN)
en_US = app['localized']['en-US']
self.assertTrue('whatsNew' in en_US)
os.chdir(os.path.join('repo', packageName))
self.assertTrue(os.path.exists(os.path.join('en-US', 'icon.png')))
self.assertTrue(os.path.exists(os.path.join('en-US', 'featureGraphic.png')))
self.assertTrue(os.path.exists(os.path.join('en-US', 'phoneScreenshots', '01_Login.jpg')))
self.assertTrue(os.path.exists(os.path.join('en-US', 'sevenInchScreenshots', '01_Login.png')))
self.assertFalse(os.path.exists(os.path.join('de-DE', 'icon.png')))
self.assertFalse(os.path.exists(os.path.join('de-DE', 'featureGraphic.png')))
self.assertFalse(os.path.exists(os.path.join('de-DE', 'phoneScreenshots', '01_Login.jpg')))
self.assertFalse(os.path.exists(os.path.join('de-DE', 'sevenInchScreenshots', '01_Login.png')))
def javagetsig(self, apkfile):
getsig_dir = 'getsig'
if not os.path.exists(getsig_dir + "/getsig.class"):