@@ -438,7 +438,7 @@ async def test_abort_firmware_update(multisensor_6, uuid4, mock_command):
438438 }
439439
440440
441- def test_node_inclusion ():
441+ def test_node_inclusion (multisensor_6_state ):
442442 """Emulate a node being added."""
443443 # when a node node is added, it has minimal info first
444444 node = node_pkg .Node (
@@ -451,8 +451,16 @@ def test_node_inclusion():
451451 assert node .device_config .manufacturer is None
452452
453453 # the ready event contains a full (and complete) dump of the node, including values
454- state = json .loads (load_fixture ("multisensor_6_state.json" ))
455- event = Event ("ready" , {"nodeState" : state })
454+ event = Event (
455+ "ready" ,
456+ {
457+ "event" : "ready" ,
458+ "source" : "node" ,
459+ "nodeId" : node .node_id ,
460+ "nodeState" : multisensor_6_state ,
461+ "result" : [],
462+ },
463+ )
456464 node .receive_event (event )
457465
458466 assert node .device_config .manufacturer == "AEON Labs"
@@ -1102,6 +1110,7 @@ async def test_statistics_updated(wallmote_central_scene: node_pkg.Node):
11021110 {
11031111 "source" : "node" ,
11041112 "event" : "statistics updated" ,
1113+ "nodeId" : node .node_id ,
11051114 "statistics" : {
11061115 "commandsTX" : 1 ,
11071116 "commandsRX" : 1 ,
@@ -1441,3 +1450,9 @@ async def test_set_keep_awake(multisensor_6: node_pkg.Node, uuid4, mock_command)
14411450 "keepAwake" : False ,
14421451 "messageId" : uuid4 ,
14431452 }
1453+
1454+
1455+ async def test_unknown_event (multisensor_6 : node_pkg .Node ):
1456+ """Test that an unknown event type causes an exception."""
1457+ with pytest .raises (KeyError ):
1458+ assert multisensor_6 .receive_event (Event ("unknown_event" , {"source" : "node" }))
0 commit comments