feat(web): add peripheral card quick controls
This commit is contained in:
@@ -1403,6 +1403,40 @@ class SelfExtensionTests(unittest.TestCase):
|
||||
self.assertEqual(operation["domain"], "self_extension")
|
||||
self.assertTrue(operation["telemetry"]["gateway_acknowledged"])
|
||||
|
||||
def test_quick_peripheral_control_reauthorizes_durable_capability(self) -> None:
|
||||
with TemporaryDirectory() as directory:
|
||||
service = SelfExtensionService(
|
||||
SimulationGateway(),
|
||||
catalog_db_path=Path(directory, "infrared.sqlite3"),
|
||||
)
|
||||
service.sync_peripheral_catalog(
|
||||
[
|
||||
{
|
||||
"id": "quick-light-on",
|
||||
"status": "learned",
|
||||
"enabled": True,
|
||||
"device_id": "quick-light",
|
||||
"device_name": "快捷灯",
|
||||
"object_names": ["快捷灯"],
|
||||
"card_uid": "2CC8B103",
|
||||
"action": "打开",
|
||||
"action_names": ["打开", "开启"],
|
||||
"slot": 8,
|
||||
}
|
||||
]
|
||||
)
|
||||
|
||||
result = service.execute_quick_peripheral_capability(
|
||||
"quick-light-on",
|
||||
conversation_id="conv-quick-light",
|
||||
)
|
||||
|
||||
self.assertTrue(result["success"])
|
||||
self.assertEqual(result["execution_mode"], "hardware")
|
||||
self.assertEqual(result["provider_requested"], "web_console_quick_control")
|
||||
self.assertEqual(result["peripheral"]["slot"], 8)
|
||||
service.close()
|
||||
|
||||
def test_main_peripheral_sequence_executes_validated_actions_and_delays(self) -> None:
|
||||
service = SelfExtensionService(SimulationGateway())
|
||||
catalog = [
|
||||
|
||||
Reference in New Issue
Block a user