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:
parent
2201df150f
commit
5f8beaa2c6
12
tests/metadata/obb.main.oldversion.txt
Normal file
12
tests/metadata/obb.main.oldversion.txt
Normal 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
|
12
tests/metadata/obb.main.twoversions.txt
Normal file
12
tests/metadata/obb.main.twoversions.txt
Normal 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
|
12
tests/metadata/obb.mainpatch.current.txt
Normal file
12
tests/metadata/obb.mainpatch.current.txt
Normal 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
|
1
tests/repo/main.1101613.obb.main.twoversions.obb
Normal file
1
tests/repo/main.1101613.obb.main.twoversions.obb
Normal file
@ -0,0 +1 @@
|
||||
dummy
|
1
tests/repo/main.1101615.obb.main.twoversions.obb
Normal file
1
tests/repo/main.1101615.obb.main.twoversions.obb
Normal file
@ -0,0 +1 @@
|
||||
dummy
|
1
tests/repo/main.1434483388.obb.main.oldversion.obb
Normal file
1
tests/repo/main.1434483388.obb.main.oldversion.obb
Normal file
@ -0,0 +1 @@
|
||||
dummy
|
1
tests/repo/main.1619.obb.mainpatch.current.obb
Normal file
1
tests/repo/main.1619.obb.mainpatch.current.obb
Normal file
@ -0,0 +1 @@
|
||||
dummy
|
BIN
tests/repo/obb.main.oldversion_1444412523.apk
Normal file
BIN
tests/repo/obb.main.oldversion_1444412523.apk
Normal file
Binary file not shown.
BIN
tests/repo/obb.main.twoversions_1101613.apk
Normal file
BIN
tests/repo/obb.main.twoversions_1101613.apk
Normal file
Binary file not shown.
BIN
tests/repo/obb.main.twoversions_1101615.apk
Normal file
BIN
tests/repo/obb.main.twoversions_1101615.apk
Normal file
Binary file not shown.
BIN
tests/repo/obb.main.twoversions_1101617.apk
Normal file
BIN
tests/repo/obb.main.twoversions_1101617.apk
Normal file
Binary file not shown.
BIN
tests/repo/obb.mainpatch.current_1619.apk
Normal file
BIN
tests/repo/obb.mainpatch.current_1619.apk
Normal file
Binary file not shown.
1
tests/repo/patch.1619.obb.mainpatch.current.obb
Normal file
1
tests/repo/patch.1619.obb.mainpatch.current.obb
Normal file
@ -0,0 +1 @@
|
||||
dummy
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user