1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-20 13:50:12 +01:00

update: fix tests when running without apksigner

This commit is contained in:
Hans-Christoph Steiner 2019-02-01 15:23:23 +01:00
parent 17dc231dc9
commit 50ca3967cc

View File

@ -388,7 +388,6 @@ class UpdateTest(unittest.TestCase):
pass # aapt is not required if androguard is present
for use_androguard in (True, False):
print('USE_ANDROGUARD', use_androguard)
if use_androguard:
try:
import androguard
@ -407,16 +406,21 @@ class UpdateTest(unittest.TestCase):
else:
continue
print('USE_ANDROGUARD', use_androguard)
apksigner = fdroidserver.common.find_sdk_tools_cmd('apksigner')
if use_androguard and apksigner: # v2 parsing needs both
config['apksigner'] = apksigner
apk_info = fdroidserver.update.scan_apk('v2.only.sig_2.apk')
self.assertIsNone(apk_info.get('maxSdkVersion'))
self.assertEqual(apk_info.get('versionName'), 'v2-only')
self.assertEqual(apk_info.get('versionCode'), 2)
apk_info = fdroidserver.update.scan_apk('repo/v1.v2.sig_1020.apk')
self.assertIsNone(apk_info.get('maxSdkVersion'))
self.assertEqual(apk_info.get('versionName'), 'v1+2')
self.assertEqual(apk_info.get('versionCode'), 1020)
apk_info = fdroidserver.update.scan_apk('v2.only.sig_2.apk')
self.assertIsNone(apk_info.get('maxSdkVersion'))
self.assertEqual(apk_info.get('versionName'), 'v2-only')
self.assertEqual(apk_info.get('versionCode'), 2)
apk_info = fdroidserver.update.scan_apk('repo/souch.smsbypass_9.apk')
self.assertIsNone(apk_info.get('maxSdkVersion'))
self.assertEqual(apk_info.get('versionName'), '0.9')