Skip to content

Commit

Permalink
resourse map never found test
Browse files Browse the repository at this point in the history
  • Loading branch information
erev0s committed Jul 8, 2024
1 parent a13e754 commit a7c0099
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Binary file not shown.
11 changes: 10 additions & 1 deletion tests/test_base.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import glob
import io
import os
import unittest
Expand All @@ -6,7 +7,7 @@
from apkInspector.extract import extract_file_based_on_header_info
from apkInspector.headers import EndOfCentralDirectoryRecord, CentralDirectory, ZipEntry, LocalHeaderRecord
from apkInspector.indicators import apk_tampering_check
from apkInspector.axml import get_manifest
from apkInspector.axml import get_manifest, parse_apk_for_manifest


class ApkInspectorTestCase(unittest.TestCase):
Expand Down Expand Up @@ -246,6 +247,14 @@ def test_inconsistencies_in_central_local_entries(self):
self.assertIn('classes.dex', res['zip tampering']['unique_entries'])
self.assertIn('classes.deP', res['zip tampering']['unique_entries'])

def test_manifest_invalid_res_map(self):
test_dir = os.path.dirname(os.path.abspath(__file__))
with open(os.path.join(test_dir, 'res', 'manifest', 'AndroidManifest_resource_map_not_found.xml'), "rb") as mf:
with self.assertRaises(ValueError) as context:
get_manifest(io.BytesIO(mf.read()))
self.assertEqual(str(context.exception), "Resource Map header was not detected.")



if __name__ == '__main__':
unittest.main()

0 comments on commit a7c0099

Please sign in to comment.