summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorjvoisin2022-09-03 16:00:53 +0200
committerjvoisin2022-09-03 16:42:39 +0200
commit2bc593e990e2915d63503df8d4be72d10fa77e9d (patch)
tree61a6aa1fe7c84aeb995a4e13cc5962389fea56aa /tests
parent2d6d30a2d11704df48c4bb46b75243d582bcc4c8 (diff)
Second commit
Diffstat (limited to '')
-rw-r--r--tests/__init__.py0
-rw-r--r--tests/test_android.py43
-rw-r--r--tests/testsdata/example.apkbin0 -> 25931 bytes
3 files changed, 43 insertions, 0 deletions
diff --git a/tests/__init__.py b/tests/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/__init__.py
diff --git a/tests/test_android.py b/tests/test_android.py
new file mode 100644
index 0000000..a72f8d8
--- /dev/null
+++ b/tests/test_android.py
@@ -0,0 +1,43 @@
1import os
2
3from karton.android import Android
4
5from karton.core import Task
6from karton.core.test import KartonTestCase, TestResource
7
8
9class AndroidMagicTestCase(KartonTestCase):
10 karton_class = Android
11
12 def test_android(self):
13 testcase = os.path.join(os.path.dirname(__file__), "testsdata", "example.apk")
14 with self.subTest(testcase):
15 with open(testcase, "rb") as f:
16 content = f.read()
17 sample = TestResource(testcase, content)
18 expected = Task(
19 {
20 "type": "sample",
21 "stage": "analyzed",
22 "origin": "karton.android",
23 },
24 payload={
25 'attributes': {
26 "certificate": ["61ED377E85D386A8DFEE6B864BD85B0BFAA5AF81"],
27 "main_activity": ["com.example.android.contactmanager..ContactManager"],
28 "package": ["com.example.android.contactmanager"],
29 "activities": ["com.example.android.contactmanager..ContactManager", "com.example.android.contactmanager.ContactAdder"],
30 "permissions": ["android.permission.GET_ACCOUNTS", "android.permission.READ_CONTACTS", "android.permission.WRITE_CONTACTS"],
31 }
32 },
33 )
34 task = Task(
35 {
36 "type": "sample",
37 "extension": "apk",
38 },
39 payload={"sample": sample},
40 )
41 results = self.run_task(task)
42
43 self.assertTasksEqual(results, [expected])
diff --git a/tests/testsdata/example.apk b/tests/testsdata/example.apk
new file mode 100644
index 0000000..418f504
--- /dev/null
+++ b/tests/testsdata/example.apk
Binary files differ