Sanitize Control Center test fixtures
This commit is contained in:
@@ -88,12 +88,12 @@ Create `tests/quickshell/kdeconnect_bridge_test.py` with import-by-path and thes
|
||||
```python
|
||||
class KdeConnectBridgeTest(unittest.TestCase):
|
||||
def test_status_omits_network_and_exposes_supported_ios_actions(self):
|
||||
listing = "- Gib's iPhone: 90B54E84548E4F109268EC2D0E7D6930 on 192.168.1.7 via LAN (paired and reachable)\n1 device found\n"
|
||||
listing = "- Fixture iPhone: BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB on 192.0.2.7 via LAN (paired and reachable)\n1 device found\n"
|
||||
plugins = ["kdeconnect_clipboard", "kdeconnect_findmyphone", "kdeconnect_ping", "kdeconnect_share"]
|
||||
device = bridge.normalize_device_line(listing.splitlines()[0], plugins)
|
||||
self.assertEqual(device["name"], "Gib's iPhone")
|
||||
self.assertEqual(device["name"], "Fixture iPhone")
|
||||
self.assertEqual(device["actions"], ["clipboard", "ping", "ring", "share"])
|
||||
self.assertNotIn("192.168.1.7", json.dumps(device))
|
||||
self.assertNotIn("192.0.2.7", json.dumps(device))
|
||||
|
||||
def test_invalid_device_id_is_rejected(self):
|
||||
with self.assertRaisesRegex(ValueError, "invalid-device"):
|
||||
@@ -105,8 +105,8 @@ class KdeConnectBridgeTest(unittest.TestCase):
|
||||
bridge.validate_file(pathlib.Path(directory))
|
||||
|
||||
def test_action_command_uses_separate_arguments(self):
|
||||
command = bridge.action_command("ring", "90B54E84548E4F109268EC2D0E7D6930")
|
||||
self.assertEqual(command, ["kdeconnect-cli", "-d", "90B54E84548E4F109268EC2D0E7D6930", "--ring"])
|
||||
command = bridge.action_command("ring", "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB")
|
||||
self.assertEqual(command, ["kdeconnect-cli", "-d", "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB", "--ring"])
|
||||
```
|
||||
|
||||
- [ ] **Step 2: Run the test and verify RED**
|
||||
|
||||
@@ -46,7 +46,7 @@ the paired iPhone exposes only a useful subset of KDE Connect.
|
||||
|
||||
## Verified system state
|
||||
|
||||
KDE Connect currently reports one paired and reachable device: `Gib's iPhone`.
|
||||
KDE Connect currently reports one paired iPhone.
|
||||
Its live D-Bus object exposes clipboard, find-my-phone, ping, share, and battery
|
||||
plugins. The battery plugin has no value, and the remote-input object exposes no
|
||||
callable control methods. Panama must derive action visibility from advertised
|
||||
|
||||
@@ -23,8 +23,8 @@ loader.exec_module(bridge)
|
||||
class KdeConnectBridgeTest(unittest.TestCase):
|
||||
def test_status_omits_network_and_exposes_supported_ios_actions(self) -> None:
|
||||
line = (
|
||||
"- Gib's iPhone: 90B54E84548E4F109268EC2D0E7D6930 "
|
||||
"on 192.168.1.7 via LAN (paired and reachable)"
|
||||
"- Fixture iPhone: BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB "
|
||||
"on 192.0.2.7 via LAN (paired and reachable)"
|
||||
)
|
||||
plugins = [
|
||||
"kdeconnect_clipboard",
|
||||
@@ -36,12 +36,12 @@ class KdeConnectBridgeTest(unittest.TestCase):
|
||||
|
||||
device = bridge.normalize_device_line(line, plugins)
|
||||
|
||||
self.assertEqual(device["name"], "Gib's iPhone")
|
||||
self.assertEqual(device["name"], "Fixture iPhone")
|
||||
self.assertEqual(device["type"], "phone")
|
||||
self.assertTrue(device["paired"])
|
||||
self.assertTrue(device["reachable"])
|
||||
self.assertEqual(device["actions"], ["clipboard", "ping", "ring", "share"])
|
||||
self.assertNotIn("192.168.1.7", json.dumps(device))
|
||||
self.assertNotIn("192.0.2.7", json.dumps(device))
|
||||
self.assertNotIn("LAN", json.dumps(device))
|
||||
|
||||
def test_status_parses_an_offline_paired_device(self) -> None:
|
||||
@@ -70,7 +70,7 @@ class KdeConnectBridgeTest(unittest.TestCase):
|
||||
self.assertEqual(bridge.validate_file(file_path), file_path.resolve())
|
||||
|
||||
def test_action_commands_use_separate_arguments(self) -> None:
|
||||
device_id = "90B54E84548E4F109268EC2D0E7D6930"
|
||||
device_id = "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"
|
||||
self.assertEqual(
|
||||
bridge.action_command("ring", device_id),
|
||||
["kdeconnect-cli", "-d", device_id, "--ring"],
|
||||
@@ -84,7 +84,7 @@ class KdeConnectBridgeTest(unittest.TestCase):
|
||||
with self.assertRaisesRegex(ValueError, "unsupported-action"):
|
||||
bridge.action_command(
|
||||
"unlock",
|
||||
"90B54E84548E4F109268EC2D0E7D6930",
|
||||
"BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
|
||||
)
|
||||
|
||||
def test_busctl_plugin_output_is_normalized(self) -> None:
|
||||
@@ -120,7 +120,7 @@ class KdeConnectBridgeTest(unittest.TestCase):
|
||||
|
||||
self.assertEqual(
|
||||
bridge.device_plugins(
|
||||
"90B54E84548E4F109268EC2D0E7D6930",
|
||||
"BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
|
||||
runner,
|
||||
),
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user