Skip to content

Commit

Permalink
Merge pull request #1597 from SmartThingsCommunity/chore/update-tests…
Browse files Browse the repository at this point in the history
…-for-native-handlers

Update tests to account for default native handler registration
  • Loading branch information
cjswedes authored Aug 30, 2024
2 parents c29e5e0 + f765e0a commit e848ae4
Show file tree
Hide file tree
Showing 43 changed files with 672 additions and 0 deletions.
16 changes: 16 additions & 0 deletions drivers/SmartThings/matter-switch/src/test/test_eve_energy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@ test.register_message_test(
{ capability = "switch", component = "main", command = "on", args = {} }
}
},
{
channel = "devices",
direction = "send",
message = {
"register_native_capability_cmd_handler",
{ device_uuid = mock_device.id, capability_id = "switch", capability_cmd_id = "on" }
}
},
{
channel = "matter",
direction = "send",
Expand All @@ -113,6 +121,14 @@ test.register_message_test(
{ capability = "switch", component = "main", command = "off", args = {} }
}
},
{
channel = "devices",
direction = "send",
message = {
"register_native_capability_cmd_handler",
{ device_uuid = mock_device.id, capability_id = "switch", capability_cmd_id = "off" }
}
},
{
channel = "matter",
direction = "send",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,14 @@ test.register_message_test(
{ capability = "switch", component = "main", command = "on", args = { } }
}
},
{
channel = "devices",
direction = "send",
message = {
"register_native_capability_cmd_handler",
{ device_uuid = mock_device.id, capability_id = "switch", capability_cmd_id = "on" }
}
},
{
channel = "matter",
direction = "send",
Expand All @@ -136,6 +144,14 @@ test.register_message_test(
{ capability = "switch", component = "main", command = "off", args = { } }
}
},
{
channel = "devices",
direction = "send",
message = {
"register_native_capability_cmd_handler",
{ device_uuid = mock_device.id, capability_id = "switch", capability_cmd_id = "off" }
}
},
{
channel = "matter",
direction = "send",
Expand All @@ -158,6 +174,14 @@ test.register_message_test(
{ capability = "switchLevel", component = "main", command = "setLevel", args = {20,20} }
}
},
{
channel = "devices",
direction = "send",
message = {
"register_native_capability_cmd_handler",
{ device_uuid = mock_device.id, capability_id = "switchLevel", capability_cmd_id = "setLevel" }
}
},
{
channel = "matter",
direction = "send",
Expand Down
24 changes: 24 additions & 0 deletions drivers/SmartThings/matter-switch/src/test/test_matter_switch.lua
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,14 @@ test.register_message_test(
{ capability = "switch", component = "main", command = "on", args = { } }
}
},
{
channel = "devices",
direction = "send",
message = {
"register_native_capability_cmd_handler",
{ device_uuid = mock_device.id, capability_id = "switch", capability_cmd_id = "on" }
}
},
{
channel = "matter",
direction = "send",
Expand All @@ -146,6 +154,14 @@ test.register_message_test(
{ capability = "switch", component = "main", command = "off", args = { } }
}
},
{
channel = "devices",
direction = "send",
message = {
"register_native_capability_cmd_handler",
{ device_uuid = mock_device.id, capability_id = "switch", capability_cmd_id = "off" }
}
},
{
channel = "matter",
direction = "send",
Expand All @@ -168,6 +184,14 @@ test.register_message_test(
{ capability = "switchLevel", component = "main", command = "setLevel", args = {20,20} }
}
},
{
channel = "devices",
direction = "send",
message = {
"register_native_capability_cmd_handler",
{ device_uuid = mock_device.id, capability_id = "switchLevel", capability_cmd_id = "setLevel" }
}
},
{
channel = "matter",
direction = "send",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,14 @@ test.register_message_test(
{ capability = "switch", component = "main", command = "on", args = { } }
}
},
{
channel = "devices",
direction = "send",
message = {
"register_native_capability_cmd_handler",
{ device_uuid = mock_device.id, capability_id = "switch", capability_cmd_id = "on" }
}
},
{
channel = "matter",
direction = "send",
Expand Down Expand Up @@ -182,6 +190,14 @@ test.register_message_test(
{ capability = "switch", component = "main", command = "on", args = { } }
}
},
{
channel = "devices",
direction = "send",
message = {
"register_native_capability_cmd_handler",
{ device_uuid = mock_children[child1_ep].id, capability_id = "switch", capability_cmd_id = "on" }
}
},
{
channel = "matter",
direction = "send",
Expand Down Expand Up @@ -217,6 +233,14 @@ test.register_message_test(
{ capability = "switch", component = "main", command = "on", args = { } }
}
},
{
channel = "devices",
direction = "send",
message = {
"register_native_capability_cmd_handler",
{ device_uuid = mock_children[child2_ep].id, capability_id = "switch", capability_cmd_id = "on" }
}
},
{
channel = "matter",
direction = "send",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,14 @@ test.register_message_test(
{ capability = "switch", component = "main", command = "on", args = { } }
}
},
{
channel = "devices",
direction = "send",
message = {
"register_native_capability_cmd_handler",
{ device_uuid = mock_device.id, capability_id = "switch", capability_cmd_id = "on" }
}
},
{
channel = "matter",
direction = "send",
Expand Down Expand Up @@ -249,6 +257,14 @@ test.register_message_test(
{ capability = "switch", component = "main", command = "on", args = { } }
}
},
{
channel = "devices",
direction = "send",
message = {
"register_native_capability_cmd_handler",
{ device_uuid = mock_children[child1_ep].id, capability_id = "switch", capability_cmd_id = "on" }
}
},
{
channel = "matter",
direction = "send",
Expand Down Expand Up @@ -284,6 +300,14 @@ test.register_message_test(
{ capability = "switch", component = "main", command = "on", args = { } }
}
},
{
channel = "devices",
direction = "send",
message = {
"register_native_capability_cmd_handler",
{ device_uuid = mock_children[child2_ep].id, capability_id = "switch", capability_cmd_id = "on" }
}
},
{
channel = "matter",
direction = "send",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,14 @@ test.register_message_test(
direction = "receive",
message = { mock_device.id, { capability = "switchLevel", component = "main", command = "setLevel", args = { 57, 0 } } }
},
{
channel = "devices",
direction = "send",
message = {
"register_native_capability_cmd_handler",
{ device_uuid = mock_device.id, capability_id = "switchLevel", capability_cmd_id = "setLevel" }
}
},
{
channel = "zigbee",
direction = "send",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ test.register_coroutine_test(
function()
test.socket.capability:__queue_receive({ mock_device.id,
{ capability = "switch", component = "main", command = "on", args = {} } })
mock_device:expect_native_cmd_handler_registration("switch", "on")
test.socket.zigbee:__expect_send({ mock_device.id,
OnOff.server.commands.On(mock_device) })
end
Expand All @@ -188,6 +189,7 @@ test.register_coroutine_test(
function()
test.socket.capability:__queue_receive({ mock_device.id,
{ capability = "switch", component = "main", command = "off", args = {} } })
mock_device:expect_native_cmd_handler_registration("switch", "off")
test.socket.zigbee:__expect_send({ mock_device.id,
OnOff.server.commands.Off(mock_device) })
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ test.register_coroutine_test(
function()
test.socket.capability:__queue_receive({ mock_device.id,
{ capability = "switch", component = "main", command = "on", args = {} } })
mock_device:expect_native_cmd_handler_registration("switch", "on")
test.socket.zigbee:__expect_send({ mock_device.id,
OnOff.server.commands.On(mock_device) })
end
Expand All @@ -189,6 +190,7 @@ test.register_coroutine_test(
function()
test.socket.capability:__queue_receive({ mock_device.id,
{ capability = "switch", component = "main", command = "off", args = {} } })
mock_device:expect_native_cmd_handler_registration("switch", "off")
test.socket.zigbee:__expect_send({ mock_device.id,
OnOff.server.commands.Off(mock_device) })
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ test.register_coroutine_test(
function()
test.socket.capability:__queue_receive({ mock_device.id,
{ capability = "switch", component = "main", command = "on", args = {} } })
mock_device:expect_native_cmd_handler_registration("switch", "on")
test.socket.zigbee:__expect_send({ mock_device.id,
OnOff.server.commands.On(mock_device) })
end
Expand All @@ -113,6 +114,7 @@ test.register_coroutine_test(
function()
test.socket.capability:__queue_receive({ mock_device.id,
{ capability = "switch", component = "main", command = "off", args = {} } })
mock_device:expect_native_cmd_handler_registration("switch", "off")
test.socket.zigbee:__expect_send({ mock_device.id,
OnOff.server.commands.Off(mock_device) })
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ test.register_coroutine_test(
function()
test.socket.capability:__queue_receive({ mock_device.id,
{ capability = "switch", component = "main", command = "on", args = {} } })
mock_device:expect_native_cmd_handler_registration("switch", "on")
test.socket.zigbee:__expect_send({ mock_device.id,
OnOff.server.commands.On(mock_device) })
end
Expand All @@ -106,6 +107,7 @@ test.register_coroutine_test(
function()
test.socket.capability:__queue_receive({ mock_device.id,
{ capability = "switch", component = "main", command = "off", args = {} } })
mock_device:expect_native_cmd_handler_registration("switch", "off")
test.socket.zigbee:__expect_send({ mock_device.id,
OnOff.server.commands.Off(mock_device) })
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ test.register_coroutine_test(
function()
test.socket.capability:__queue_receive({ mock_device.id,
{ capability = "switch", component = "main", command = "on", args = {} } })
mock_device:expect_native_cmd_handler_registration("switch", "on")
test.socket.zigbee:__expect_send({ mock_device.id,
OnOff.server.commands.On(mock_device) })
end
Expand All @@ -163,6 +164,7 @@ test.register_coroutine_test(
function()
test.socket.capability:__queue_receive({ mock_child.id,
{ capability = "switch", component = "main", command = "on", args = {} } })
mock_child:expect_native_cmd_handler_registration("switch", "on")
test.socket.zigbee:__expect_send({ mock_device.id,
OnOff.server.commands.On(mock_device):to_endpoint(0x02) })
end
Expand All @@ -173,6 +175,7 @@ test.register_coroutine_test(
function()
test.socket.capability:__queue_receive({ mock_device.id,
{ capability = "switch", component = "main", command = "off", args = {} } })
mock_device:expect_native_cmd_handler_registration("switch", "off")
test.socket.zigbee:__expect_send({ mock_device.id,
OnOff.server.commands.Off(mock_device) })
end
Expand All @@ -183,6 +186,7 @@ test.register_coroutine_test(
function()
test.socket.capability:__queue_receive({ mock_child.id,
{ capability = "switch", component = "main", command = "off", args = {} } })
mock_child:expect_native_cmd_handler_registration("switch", "off")
test.socket.zigbee:__expect_send({ mock_device.id,
OnOff.server.commands.Off(mock_device):to_endpoint(0x02) })
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ test.register_coroutine_test(
function()
test.socket.capability:__queue_receive({ mock_device.id,
{ capability = "switch", component = "main", command = "on", args = {} } })
mock_device:expect_native_cmd_handler_registration("switch", "on")
test.socket.zigbee:__expect_send({ mock_device.id,
OnOff.server.commands.On(mock_device) })
end
Expand All @@ -198,6 +199,7 @@ test.register_coroutine_test(
function()
test.socket.capability:__queue_receive({ mock_child.id,
{ capability = "switch", component = "main", command = "on", args = {} } })
mock_child:expect_native_cmd_handler_registration("switch", "on")
test.socket.zigbee:__expect_send({ mock_device.id,
OnOff.server.commands.On(mock_device):to_endpoint(0x02) })
end
Expand All @@ -208,6 +210,7 @@ test.register_coroutine_test(
function()
test.socket.capability:__queue_receive({ mock_device.id,
{ capability = "switch", component = "main", command = "off", args = {} } })
mock_device:expect_native_cmd_handler_registration("switch", "off")
test.socket.zigbee:__expect_send({ mock_device.id,
OnOff.server.commands.Off(mock_device) })
end
Expand All @@ -218,6 +221,7 @@ test.register_coroutine_test(
function()
test.socket.capability:__queue_receive({ mock_child.id,
{ capability = "switch", component = "main", command = "off", args = {} } })
mock_child:expect_native_cmd_handler_registration("switch", "off")
test.socket.zigbee:__expect_send({ mock_device.id,
OnOff.server.commands.Off(mock_device):to_endpoint(0x02) })
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ test.register_coroutine_test(
function()
test.socket.capability:__queue_receive({ mock_device.id,
{ capability = "switch", component = "main", command = "on", args = {} } })
mock_device:expect_native_cmd_handler_registration("switch", "on")
test.socket.zigbee:__expect_send({ mock_device.id,
OnOff.server.commands.On(mock_device) })
end
Expand All @@ -113,6 +114,7 @@ test.register_coroutine_test(
function()
test.socket.capability:__queue_receive({ mock_child.id,
{ capability = "switch", component = "main", command = "on", args = {} } })
mock_child:expect_native_cmd_handler_registration("switch", "on")
test.socket.zigbee:__expect_send({ mock_device.id,
OnOff.server.commands.On(mock_device):to_endpoint(0x02) })
end
Expand All @@ -123,6 +125,7 @@ test.register_coroutine_test(
function()
test.socket.capability:__queue_receive({ mock_device.id,
{ capability = "switch", component = "main", command = "off", args = {} } })
mock_device:expect_native_cmd_handler_registration("switch", "off")
test.socket.zigbee:__expect_send({ mock_device.id,
OnOff.server.commands.Off(mock_device) })
end
Expand All @@ -133,6 +136,7 @@ test.register_coroutine_test(
function()
test.socket.capability:__queue_receive({ mock_child.id,
{ capability = "switch", component = "main", command = "off", args = {} } })
mock_child:expect_native_cmd_handler_registration("switch", "off")
test.socket.zigbee:__expect_send({ mock_device.id,
OnOff.server.commands.Off(mock_device):to_endpoint(0x02) })
end
Expand Down
Loading

0 comments on commit e848ae4

Please sign in to comment.