1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-04 22:40:12 +01:00

tests for finding the proper OBB files for each APK

This commit is contained in:
Hans-Christoph Steiner 2016-06-20 13:41:30 +02:00
parent 2201df150f
commit 5f8beaa2c6
14 changed files with 67 additions and 5 deletions

View File

@ -0,0 +1,12 @@
Categories:Development
License:GPLv3
Source Code:https://github.com/eighthave/urzip
Bitcoin:1Fi5xUHiAPRKxHvyUGVFGt9extBe8Srdbk
Auto Name:OBB Main Old Version
Repo Type:git
Repo:https://github.com/eighthave/urzip.git
Current Version Code:99999999

View File

@ -0,0 +1,12 @@
Categories:Development
License:GPLv3
Source Code:https://github.com/eighthave/urzip
Bitcoin:1Fi5xUHiAPRKxHvyUGVFGt9extBe8Srdbk
Auto Name:OBB Two Versions
Repo Type:git
Repo:https://github.com/eighthave/urzip.git
Current Version Code:99999999

View File

@ -0,0 +1,12 @@
Categories:Development
License:GPLv3
Source Code:https://github.com/eighthave/urzip
Bitcoin:1Fi5xUHiAPRKxHvyUGVFGt9extBe8Srdbk
Auto Name:OBB Main+Patch Current Version
Repo Type:git
Repo:https://github.com/eighthave/urzip.git
Current Version Code:99999999

View File

@ -0,0 +1 @@
dummy

View File

@ -0,0 +1 @@
dummy

View File

@ -0,0 +1 @@
dummy

View File

@ -0,0 +1 @@
dummy

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1 @@
dummy

View File

@ -83,7 +83,7 @@ class UpdateTest(unittest.TestCase):
pysig = fdroidserver.update.getsig(apkfile)
self.assertIsNone(pysig, "python sig should be None: " + str(sig))
def testScanApks(self):
def testScanApksAndObbs(self):
os.chdir(os.path.dirname(__file__))
if os.path.basename(os.getcwd()) != 'tests':
raise Exception('This test must be run in the "tests/" subdir')
@ -97,18 +97,39 @@ class UpdateTest(unittest.TestCase):
fdroidserver.update.options = type('', (), {})()
fdroidserver.update.options.clean = True
fdroidserver.update.options.delete_unknown = True
alltestapps = fdroidserver.metadata.read_metadata(xref=True)
apps = dict()
apps['info.guardianproject.urzip'] = alltestapps['info.guardianproject.urzip']
apps = fdroidserver.metadata.read_metadata(xref=True)
knownapks = fdroidserver.common.KnownApks()
apks, cachechanged = fdroidserver.update.scan_apks(apps, {}, 'repo', knownapks, False)
self.assertEqual(len(apks), 1)
self.assertEqual(len(apks), 6)
apk = apks[0]
self.assertEqual(apk['minSdkVersion'], '4')
self.assertEqual(apk['targetSdkVersion'], '18')
self.assertFalse('maxSdkVersion' in apk)
fdroidserver.update.insert_obbs('repo', apps, apks)
for apk in apks:
if apk['id'] == 'obb.mainpatch.current':
self.assertEqual(apk.get('obbMainFile'), 'main.1619.obb.mainpatch.current.obb')
self.assertEqual(apk.get('obbPatchFile'), 'patch.1619.obb.mainpatch.current.obb')
elif apk['id'] == 'obb.main.oldversion':
self.assertEqual(apk.get('obbMainFile'), 'main.1434483388.obb.main.oldversion.obb')
self.assertIsNone(apk.get('obbPatchFile'))
elif apk['id'] == 'obb.main.twoversions':
self.assertIsNone(apk.get('obbPatchFile'))
if apk['versioncode'] == 1101613:
self.assertEqual(apk.get('obbMainFile'), 'main.1101613.obb.main.twoversions.obb')
elif apk['versioncode'] == 1101615:
self.assertEqual(apk.get('obbMainFile'), 'main.1101615.obb.main.twoversions.obb')
elif apk['versioncode'] == 1101617:
self.assertEqual(apk.get('obbMainFile'), 'main.1101615.obb.main.twoversions.obb')
else:
self.assertTrue(False)
elif apk['id'] == 'info.guardianproject.urzip':
self.assertIsNone(apk.get('obbMainFile'))
self.assertIsNone(apk.get('obbPatchFile'))
if __name__ == "__main__":
parser = optparse.OptionParser()