-
Notifications
You must be signed in to change notification settings - Fork 531
Expand file tree
/
Copy pathtest_zwave_fibaro_button.lua
More file actions
64 lines (56 loc) · 1.93 KB
/
test_zwave_fibaro_button.lua
File metadata and controls
64 lines (56 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
-- Copyright 2022 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0
local test = require "integration_test"
local capabilities = require "st.capabilities"
local zw = require "st.zwave"
local zw_test_utils = require "integration_test.zwave_test_utils"
local Battery = (require "st.zwave.CommandClass.Battery")({ version=1 })
local t_utils = require "integration_test.utils"
local button_endpoints = {
{
command_classes = {
{value = zw.CENTRAL_SCENE},
{value = zw.BATTERY}
}
}
}
local mock_fibaro_button = test.mock_device.build_test_zwave_device({
profile = t_utils.get_profile_definition("button-generic.yml"),
zwave_endpoints = button_endpoints,
zwave_manufacturer_id = 0x010F,
zwave_product_type = 0x0F01,
zwave_product_id = 0x1000
})
local function test_init()
test.mock_device.add_test_device(mock_fibaro_button)
end
test.set_test_init_function(test_init)
test.register_coroutine_test(
"Fibaro button's supported button values",
function()
test.socket.capability:__set_channel_ordering("relaxed")
test.socket.device_lifecycle:__queue_receive({ mock_fibaro_button.id, "added" })
test.socket.capability:__expect_send(
mock_fibaro_button:generate_test_message(
"main",
capabilities.button.supportedButtonValues({"pushed", "held", "down_hold", "double", "pushed_3x", "pushed_4x", "pushed_5x"}, {visibility = { displayed = false }})
)
)
test.socket.capability:__expect_send(
mock_fibaro_button:generate_test_message(
"main",
capabilities.button.numberOfButtons({ value = 1 }, {visibility = { displayed = false }})
)
)
test.socket.zwave:__expect_send(
zw_test_utils.zwave_test_build_send_command(
mock_fibaro_button,
Battery:Get({})
)
)
end,
{
min_api_version = 17
}
)
test.run_registered_tests()