1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-10-04 02:00:11 +02:00

update: test scan_apk() with both aapt and androguard

#568
This commit is contained in:
Hans-Christoph Steiner 2018-09-17 23:25:03 +02:00
parent 3e0d1beb09
commit 92c4f048de

View File

@ -338,6 +338,31 @@ class UpdateTest(unittest.TestCase):
if os.path.basename(os.getcwd()) != 'tests': if os.path.basename(os.getcwd()) != 'tests':
raise Exception('This test must be run in the "tests/" subdir') raise Exception('This test must be run in the "tests/" subdir')
try:
config['aapt'] = fdroidserver.common.find_sdk_tools_cmd('aapt')
except fdroidserver.exception.FDroidException:
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
androguard
def func():
return True
fdroidserver.common.use_androguard = func
except ImportError:
continue
else:
if 'aapt' in config:
def func():
return False
fdroidserver.common.use_androguard = func
else:
continue
apk_info = fdroidserver.update.scan_apk('repo/souch.smsbypass_9.apk') apk_info = fdroidserver.update.scan_apk('repo/souch.smsbypass_9.apk')
self.assertIsNone(apk_info.get('maxSdkVersion')) self.assertIsNone(apk_info.get('maxSdkVersion'))
self.assertEqual(apk_info.get('versionName'), '0.9') self.assertEqual(apk_info.get('versionName'), '0.9')