mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-20 13:26:02 +00:00
fix: droiddeckctl refuses a DROIDDECK_PACKAGE that is not a package name (#896)
The value goes to the device shell inside `am start -n` and `content call --uri`. Anything but a dotted Android package name is refused before adb runs.
This commit is contained in:
1 parent
99381a8f3e
commit
0b8d55d434
2 files changed
+13
No files matched your search
@@ -160,6 +160,16 @@ class DroiddeckctlTest(FakeAdbTest):
|
||||
started = [e["args"] for e in self.calls() if e["args"][:3] == ["shell", "am", "start"]]
|
||||
self.assertIn("com.antutu.benchmark.full/com.droiddeck.launcher.agent.AgentStartActivity", started[0])
|
||||
|
||||
def test_a_malformed_package_is_refused_before_adb(self):
|
||||
with unittest.mock.patch.dict(os.environ, {"DROIDDECK_PACKAGE": "com.example;reboot"}):
|
||||
variant = load("droiddeckctl")
|
||||
out = io.StringIO()
|
||||
with contextlib.redirect_stdout(out), contextlib.redirect_stderr(io.StringIO()):
|
||||
code = variant.main(["--adb", str(self.adb), "--serial", "fake-1", "state"])
|
||||
self.assertEqual(2, code)
|
||||
self.assertEqual("INVALID_REQUEST", json.loads(out.getvalue())["error"]["code"])
|
||||
self.assertFalse(self.calls())
|
||||
|
||||
def test_state_passes_through_with_the_serial(self):
|
||||
self.configure({"state": state()})
|
||||
code, out = self.run_ctl("state")
|
||||
|
||||
Reference in new issue
Block a user