1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-19 21:30:10 +01:00

Fix androguard_test

- SdkToolsPopen expects a list.
- info.guardianproject.urzip.apk is not in the repo.
- scan_apk_aapt was removed in 08931f45 so define output.
This commit is contained in:
Jochen Sprickerhof 2022-05-08 12:21:49 +02:00 committed by Hans-Christoph Steiner
parent 1b67af4367
commit e82888837e

View File

@ -48,25 +48,61 @@ class UpdateTest(unittest.TestCase):
fdroidserver.update.options.clean = True
fdroidserver.update.options.delete_unknown = True
self.assertTrue(fdroidserver.common.SdkToolsPopen('aapt'))
self.assertTrue(fdroidserver.common.SdkToolsPopen(['aapt']))
try:
from androguard.core.bytecodes.apk import APK
dir(APK)
except ImportError:
raise Exception("androguard not installed!")
apkList = ['../info.guardianproject.urzip.apk', '../org.dyndns.fules.ck_20.apk']
apkList = [
(
'../org.dyndns.fules.ck_20.apk',
{
'apkName': '../org.dyndns.fules.ck_20.apk',
'uses-permission': [
fdroidserver.update.UsesPermission(
name='android.permission.BIND_INPUT_METHOD',
maxSdkVersion=None,
),
fdroidserver.update.UsesPermission(
name='android.permission.READ_EXTERNAL_STORAGE',
maxSdkVersion=None,
),
fdroidserver.update.UsesPermission(
name='android.permission.VIBRATE', maxSdkVersion=None
),
],
'uses-permission-sdk-23': [],
'features': [],
'icons_src': {
'240': 'res/drawable-hdpi-v4/icon_launcher.png',
'120': 'res/drawable-ldpi-v4/icon_launcher.png',
'160': 'res/drawable-mdpi-v4/icon_launcher.png',
'-1': 'res/drawable-mdpi-v4/icon_launcher.png',
},
'packageName': 'org.dyndns.fules.ck',
'versionCode': 20,
'versionName': 'v1.6pre2',
'minSdkVersion': 7,
'targetSdkVersion': 8,
'nativecode': [
'arm64-v8a',
'armeabi',
'armeabi-v7a',
'mips',
'mips64',
'x86',
'x86_64',
],
},
)
]
for apkName in apkList:
for apkName, apkaapt in apkList:
logging.debug("Processing " + apkName)
apkfile = os.path.join('repo', apkName)
apkaapt = _create_apkmetadata_object(apkName)
logging.debug("Using AAPT for metadata")
fdroidserver.update.scan_apk_aapt(apkaapt, apkfile)
# avoid AAPT application name bug
del apkaapt['name']
apkandroguard = _create_apkmetadata_object(apkName)
logging.debug("Using androguard for metadata")
fdroidserver.update.scan_apk_androguard(apkandroguard, apkfile)