@@ -17,19 +17,6 @@ local access_control_event = Notification.event.access_control
1717
1818test .disable_startup_messages ()
1919
20-
21- if table_utils .find_all_entries_by == nil then
22- function table_utils .find_all_entries_by (device , table_name , key , value )
23- local entries = table_utils .get_state (device , table_name ) or {}
24- local matches = {}
25- for _ , entry in ipairs (entries ) do
26- if entry [key ] == value then table.insert (matches , entry ) end
27- end
28- return matches
29- end
30- end
31-
32-
3320local zwave_lock_endpoints = {
3421 {
3522 command_classes = {
@@ -57,7 +44,10 @@ local function install_state_mocks()
5744 rawset (mock_device , " log" , {
5845 debug = function () end , info = function () end , warn = function () end , error = function () end ,
5946 })
60- rawset (mock_device , " supports_capability" , function () return true end )
47+ rawset (mock_device , " supports_capability" , function (_ , capability )
48+ local id = type (capability ) == " table" and capability .ID or capability
49+ return id == capabilities .lockUsers .ID or id == capabilities .lockCredentials .ID
50+ end )
6151 mock_device .get_latest_state = function (_ , component_id , capability_id , attribute_name , default_value )
6252 local value = mock_latest_state [mock_state_key (component_id , capability_id , attribute_name )]
6353 if value == nil then
@@ -447,10 +437,11 @@ test.register_coroutine_test(
447437 { capability = capabilities .lockCredentials .ID , command = " deleteAllCredentials" , args = {} },
448438 })
449439
440+ -- Per-credential clears fire at 2 * (i - 1) s; final cleanup at 2 * #credentials + 4 s.
450441 test .timer .__create_and_queue_test_time_advance_timer (0 , " oneshot" )
451442 test .timer .__create_and_queue_test_time_advance_timer (6 , " oneshot" )
452- test .mock_time .advance_time (0 )
453443 expect_clear_pin_code (1 )
444+ test .mock_time .advance_time (0 )
454445 test .wait_for_events ()
455446
456447 test .mock_time .advance_time (6 )
@@ -500,8 +491,6 @@ test.register_coroutine_test(
500491test .register_coroutine_test (
501492 " deleteAllCredentials: returns busy when another operation is already in progress" ,
502493 function ()
503- seed_credentials ({ { userIndex = 1 , credentialIndex = 1 , credentialType = " pin" } })
504-
505494 -- First deleteAllCredentials starts the z-wave flow (device is now busy)
506495 test .socket .capability :__queue_receive ({
507496 mock_device .id ,
0 commit comments