Skip to content

Commit 13e330e

Browse files
authored
Merge pull request #1818 from SmartThingsCommunity/chore/fixup-unit-tests
Chore/fixup unit tests for 0.55 api v12 release
2 parents 0ccdd93 + 20e4872 commit 13e330e

10 files changed

+17
-45
lines changed

drivers/SmartThings/matter-switch/src/test/test_matter_multi_button_switch_mcd.lua

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -256,14 +256,6 @@ test.register_message_test(
256256
{ capability = "switch", component = "main", command = "on", args = { } }
257257
}
258258
},
259-
{
260-
channel = "devices",
261-
direction = "send",
262-
message = {
263-
"register_native_capability_cmd_handler",
264-
{ device_uuid = mock_device.id, capability_id = "switch", capability_cmd_id = "on" }
265-
}
266-
},
267259
{
268260
channel = "matter",
269261
direction = "send",

drivers/SmartThings/matter-switch/src/test/test_matter_switch_device_types.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,9 @@ end
345345

346346
local function test_init_water_valve()
347347
test.mock_device.add_test_device(mock_device_water_valve)
348+
test.socket.device_lifecycle:__queue_receive({ mock_device_water_valve.id, "doConfigure" })
348349
mock_device_water_valve:expect_metadata_update({ profile = "water-valve-level" })
350+
mock_device_water_valve:expect_metadata_update({ provisioning_state = "PROVISIONED" })
349351
end
350352

351353
local function test_init_parent_child_different_types()
@@ -394,6 +396,7 @@ local function test_init_parent_child_unsupported_device_type()
394396
})
395397
end
396398

399+
397400
test.register_coroutine_test(
398401
"Test profile change on init for onoff parent cluster as server",
399402
function()

drivers/SmartThings/zigbee-switch/src/test/test_all_capability_zigbee_bulb.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ test.register_coroutine_test(
348348
function()
349349
test.timer.__create_and_queue_test_time_advance_timer(2, "oneshot")
350350
test.socket.capability:__queue_receive({mock_device.id, { capability = "colorControl", component = "main", command = "setColor", args = { { hue = 50, saturation = 50 } } } })
351+
mock_device:expect_native_cmd_handler_registration("colorControl", "setColor")
351352
test.socket.zigbee:__expect_send(
352353
{
353354
mock_device.id,
@@ -382,6 +383,7 @@ test.register_coroutine_test(
382383
function()
383384
test.socket.zigbee:__set_channel_ordering("relaxed")
384385
test.socket.capability:__queue_receive({mock_device.id, { capability = "colorTemperature", component = "main", command = "setColorTemperature", args = {1800}}})
386+
mock_device:expect_native_cmd_handler_registration("colorTemperature", "setColorTemperature")
385387
test.socket.zigbee:__expect_send({mock_device.id, ColorControl.server.commands.MoveToColorTemperature(mock_device, 556, 0x0000)})
386388
test.socket.zigbee:__expect_send({mock_device.id, OnOff.server.commands.On(mock_device)})
387389
test.wait_for_events()

drivers/SmartThings/zigbee-switch/src/test/test_aqara_led_bulb.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ test.register_coroutine_test(
123123
test.socket.capability:__queue_receive({ mock_device.id,
124124
{ capability = "colorTemperature", component = "main", command = "setColorTemperature", args = { 200 } } })
125125

126+
mock_device:expect_native_cmd_handler_registration("colorTemperature", "setColorTemperature")
126127
local temp_in_mired = math.floor(1000000 / 200)
127128
test.socket.zigbee:__expect_send(
128129
{

drivers/SmartThings/zigbee-switch/src/test/test_aqara_light.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ test.register_coroutine_test(
128128
test.socket.capability:__queue_receive({ mock_device.id,
129129
{ capability = "colorTemperature", component = "main", command = "setColorTemperature", args = { 200 } } })
130130

131+
mock_device:expect_native_cmd_handler_registration("colorTemperature", "setColorTemperature")
131132
local temp_in_mired = math.floor(1000000 / 200)
132133
test.socket.zigbee:__expect_send(
133134
{

drivers/SmartThings/zigbee-switch/src/test/test_rgb_bulb.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ test.register_coroutine_test(
131131
test.timer.__create_and_queue_test_time_advance_timer(2, "oneshot")
132132
test.socket.capability:__queue_receive({mock_device.id, { capability = "colorControl", component = "main", command = "setHue", args = { 50 } } })
133133

134+
mock_device:expect_native_cmd_handler_registration("colorControl", "setHue")
134135
test.socket.zigbee:__expect_send({ mock_device.id, OnOff.commands.On(mock_device) })
135136

136137
local hue = math.floor((50 * 0xFE) / 100.0 + 0.5)
@@ -154,6 +155,7 @@ test.register_coroutine_test(
154155
test.timer.__create_and_queue_test_time_advance_timer(2, "oneshot")
155156
test.socket.capability:__queue_receive({mock_device.id, { capability = "colorControl", component = "main", command = "setSaturation", args = { 50 } } })
156157

158+
mock_device:expect_native_cmd_handler_registration("colorControl", "setSaturation")
157159
test.socket.zigbee:__expect_send({ mock_device.id, OnOff.commands.On(mock_device) })
158160

159161
local saturation = math.floor((50 * 0xFE) / 100.0 + 0.5)
@@ -176,6 +178,7 @@ test.register_coroutine_test(
176178
function()
177179
test.timer.__create_and_queue_test_time_advance_timer(2, "oneshot")
178180
test.socket.capability:__queue_receive({mock_device.id, { capability = "colorControl", component = "main", command = "setColor", args = { { hue = 50, saturation = 50 } } } })
181+
mock_device:expect_native_cmd_handler_registration("colorControl", "setColor")
179182
test.socket.zigbee:__expect_send(
180183
{
181184
mock_device.id,

drivers/SmartThings/zigbee-switch/src/test/test_rgbw_bulb.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ test.register_coroutine_test(
162162
test.timer.__create_and_queue_test_time_advance_timer(2, "oneshot")
163163
test.socket.capability:__queue_receive({mock_device.id, { capability = "colorControl", component = "main", command = "setHue", args = { 50 } } })
164164

165+
mock_device:expect_native_cmd_handler_registration("colorControl", "setHue")
165166
test.socket.zigbee:__expect_send({ mock_device.id, OnOff.commands.On(mock_device) })
166167

167168
local hue = math.floor((50 * 0xFE) / 100.0 + 0.5)
@@ -185,6 +186,7 @@ test.register_coroutine_test(
185186
test.timer.__create_and_queue_test_time_advance_timer(2, "oneshot")
186187
test.socket.capability:__queue_receive({mock_device.id, { capability = "colorControl", component = "main", command = "setSaturation", args = { 50 } } })
187188

189+
mock_device:expect_native_cmd_handler_registration("colorControl", "setSaturation")
188190
test.socket.zigbee:__expect_send({ mock_device.id, OnOff.commands.On(mock_device) })
189191

190192
local saturation = math.floor((50 * 0xFE) / 100.0 + 0.5)
@@ -208,6 +210,7 @@ test.register_coroutine_test(
208210
test.timer.__create_and_queue_test_time_advance_timer(2, "oneshot")
209211
test.socket.capability:__queue_receive({mock_device.id, { capability = "colorControl", component = "main", command = "setColor", args = { { hue = 50, saturation = 50 } } } })
210212

213+
mock_device:expect_native_cmd_handler_registration("colorControl", "setColor")
211214
test.socket.zigbee:__expect_send({ mock_device.id, OnOff.server.commands.On(mock_device) })
212215

213216
local hue = math.floor((50 * 0xFE) / 100.0 + 0.5)
@@ -228,7 +231,7 @@ test.register_coroutine_test(
228231
)
229232

230233
test.register_coroutine_test(
231-
"Set Saturation command test",
234+
"Set ColorTemperature command test",
232235
function()
233236
test.timer.__create_and_queue_test_time_advance_timer(1, "oneshot")
234237
test.socket.capability:__queue_receive({mock_device.id, { capability = "colorTemperature", component = "main", command = "setColorTemperature", args = { 200 } } })

drivers/SmartThings/zigbee-switch/src/test/test_zll_rgbw_bulb.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ test.register_coroutine_test(
197197
test.timer.__create_and_queue_test_time_advance_timer(2, "oneshot")
198198
test.socket.capability:__queue_receive({mock_device.id, { capability = "colorControl", component = "main", command = "setHue", args = { 50 } } })
199199

200+
mock_device:expect_native_cmd_handler_registration("colorControl", "setHue")
200201
test.socket.zigbee:__expect_send({ mock_device.id, OnOff.commands.On(mock_device) })
201202

202203
local hue = math.floor((50 * 0xFE) / 100.0 + 0.5)
@@ -221,6 +222,7 @@ test.register_coroutine_test(
221222
test.timer.__create_and_queue_test_time_advance_timer(2, "oneshot")
222223
test.socket.capability:__queue_receive({mock_device.id, { capability = "colorControl", component = "main", command = "setSaturation", args = { 50 } } })
223224

225+
mock_device:expect_native_cmd_handler_registration("colorControl", "setSaturation")
224226
test.socket.zigbee:__expect_send({ mock_device.id, OnOff.commands.On(mock_device) })
225227

226228
local saturation = math.floor((50 * 0xFE) / 100.0 + 0.5)
@@ -245,6 +247,7 @@ test.register_coroutine_test(
245247
test.timer.__create_and_queue_test_time_advance_timer(2, "oneshot")
246248
test.socket.capability:__queue_receive({mock_device.id, { capability = "colorControl", component = "main", command = "setColor", args = { { hue = 50, saturation = 50 } } } })
247249

250+
mock_device:expect_native_cmd_handler_registration("colorControl", "setColor")
248251
test.socket.zigbee:__expect_send({ mock_device.id, OnOff.server.commands.On(mock_device) })
249252

250253
local hue = math.floor((50 * 0xFE) / 100.0 + 0.5)

drivers/SmartThings/zwave-switch/src/test/test_fibaro_walli_double_switch.lua

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,6 @@ test.register_coroutine_test(
437437
mock_parent.id,
438438
{ capability = "switch", component = "main", command = "on", args = {} }
439439
})
440-
mock_parent:expect_native_cmd_handler_registration("switch", "on")
441440

442441
test.socket.zwave:__expect_send(
443442
zw_test_utils.zwave_test_build_send_command(
@@ -505,7 +504,6 @@ test.register_coroutine_test(
505504
mock_parent.id,
506505
{ capability = "switch", component = "main", command = "off", args = {} }
507506
})
508-
mock_parent:expect_native_cmd_handler_registration("switch", "off")
509507

510508
test.socket.zwave:__expect_send(
511509
zw_test_utils.zwave_test_build_send_command(
@@ -572,7 +570,6 @@ test.register_coroutine_test(
572570
mock_child.id,
573571
{ capability = "switch", component = "main", command = "on", args = {} }
574572
})
575-
mock_child:expect_native_cmd_handler_registration("switch", "on")
576573

577574
test.socket.zwave:__expect_send(
578575
zw_test_utils.zwave_test_build_send_command(
@@ -637,7 +634,6 @@ test.register_coroutine_test(
637634
mock_child.id,
638635
{ capability = "switch", component = "main", command = "off", args = {} }
639636
})
640-
mock_child:expect_native_cmd_handler_registration("switch", "off")
641637

642638
test.socket.zwave:__expect_send(
643639
zw_test_utils.zwave_test_build_send_command(

drivers/SmartThings/zwave-switch/src/test/test_zooz_double_plug.lua

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -191,14 +191,6 @@ test.register_message_test(
191191
{ capability = "switch", command = "on", component = "switch1", args = {} }
192192
}
193193
},
194-
{
195-
channel = "devices",
196-
direction = "send",
197-
message = {
198-
"register_native_capability_cmd_handler",
199-
{ device_uuid = mock_parent.id, capability_id = "switch", capability_cmd_id = "on" }
200-
}
201-
},
202194
{
203195
channel = "zwave",
204196
direction = "send",
@@ -223,14 +215,6 @@ test.register_message_test(
223215
{ capability = "switch", command = "off", component = "main", args = {} }
224216
}
225217
},
226-
{
227-
channel = "devices",
228-
direction = "send",
229-
message = {
230-
"register_native_capability_cmd_handler",
231-
{ device_uuid = mock_parent.id, capability_id = "switch", capability_cmd_id = "off" }
232-
}
233-
},
234218
{
235219
channel = "zwave",
236220
direction = "send",
@@ -256,14 +240,6 @@ test.register_message_test(
256240
{ capability = "switch", command = "on", component = "switch1", args = {} }
257241
}
258242
},
259-
{
260-
channel = "devices",
261-
direction = "send",
262-
message = {
263-
"register_native_capability_cmd_handler",
264-
{ device_uuid = mock_child.id, capability_id = "switch", capability_cmd_id = "on" }
265-
}
266-
},
267243
{
268244
channel = "zwave",
269245
direction = "send",
@@ -288,14 +264,6 @@ test.register_message_test(
288264
{ capability = "switch", command = "off", component = "main", args = {} }
289265
}
290266
},
291-
{
292-
channel = "devices",
293-
direction = "send",
294-
message = {
295-
"register_native_capability_cmd_handler",
296-
{ device_uuid = mock_child.id, capability_id = "switch", capability_cmd_id = "off" }
297-
}
298-
},
299267
{
300268
channel = "zwave",
301269
direction = "send",

0 commit comments

Comments
 (0)