Keep offline phone capabilities visible
This commit is contained in:
@@ -6,6 +6,7 @@ import importlib.machinery
|
||||
import importlib.util
|
||||
import json
|
||||
import pathlib
|
||||
import subprocess
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
@@ -103,6 +104,32 @@ class KdeConnectBridgeTest(unittest.TestCase):
|
||||
],
|
||||
)
|
||||
|
||||
def test_offline_device_falls_back_to_supported_plugins(self) -> None:
|
||||
def runner(command: list[str], **_kwargs: object) -> subprocess.CompletedProcess[str]:
|
||||
member = command[-1]
|
||||
if member == "loadedPlugins":
|
||||
return subprocess.CompletedProcess(command, 0, "as 0\n", "")
|
||||
if member == "supportedPlugins":
|
||||
return subprocess.CompletedProcess(
|
||||
command,
|
||||
0,
|
||||
'as 3 "kdeconnect_share" "kdeconnect_clipboard" "kdeconnect_findmyphone"\n',
|
||||
"",
|
||||
)
|
||||
raise AssertionError(command)
|
||||
|
||||
self.assertEqual(
|
||||
bridge.device_plugins(
|
||||
"90B54E84548E4F109268EC2D0E7D6930",
|
||||
runner,
|
||||
),
|
||||
[
|
||||
"kdeconnect_share",
|
||||
"kdeconnect_clipboard",
|
||||
"kdeconnect_findmyphone",
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user