update: fix running without androguard

Soon, we can rip out all the aapt parsing stuff, but not yet!
This commit is contained in:
Hans-Christoph Steiner 2019-02-01 14:45:22 +01:00
parent 5d39a97ab8
commit 17dc231dc9
2 changed files with 8 additions and 4 deletions

View file

@ -255,9 +255,13 @@ class UpdateTest(unittest.TestCase):
self.assertEqual(good_fingerprint, sig,
'python sig was: ' + str(sig))
# check that v1 and v2 have the same certificate
import hashlib
from binascii import hexlify
from androguard.core.bytecodes.apk import APK
try:
import hashlib
from binascii import hexlify
from androguard.core.bytecodes.apk import APK
except ImportError:
print('WARNING: skipping rest of test since androguard is missing!')
return
apkobject = APK(apkpath)
cert_encoded = apkobject.get_certificates_der_v2()[0]
self.assertEqual(good_fingerprint, sig,