@@ -15,28 +15,6 @@ local PRIVATE_ATTR_ID_WATT = 0x130A000A
1515local PRIVATE_ATTR_ID_WATT_ACCUMULATED = 0x130A000B
1616local PRIVATE_ATTR_ID_ACCUMULATED_CONTROL_POINT = 0x130A000E
1717
18- -- Helper function to add get_endpoints method to mock devices for can_handle testing
19- local function add_get_endpoints_to_mock (device )
20- device .get_endpoints = function (self , cluster_id , opts )
21- opts = opts or {}
22- local eps = {}
23- for _ , ep in ipairs (self .endpoints ) do
24- for _ , cluster in ipairs (ep .clusters or {}) do
25- if cluster .cluster_id == cluster_id then
26- -- Check feature_bitmap if specified
27- if opts .feature_bitmap == nil or
28- (cluster .feature_map and (cluster .feature_map & opts .feature_bitmap ) == opts .feature_bitmap ) then
29- table.insert (eps , ep .endpoint_id )
30- break
31- end
32- end
33- end
34- end
35- return eps
36- end
37- return device
38- end
39-
4018local mock_device = test .mock_device .build_test_matter_device ({
4119 profile = t_utils .get_profile_definition (" power-energy-powerConsumption.yml" ),
4220 manufacturer_info = {
@@ -75,7 +53,6 @@ local mock_device = test.mock_device.build_test_matter_device({
7553 }
7654 }
7755})
78- add_get_endpoints_to_mock (mock_device )
7956
8057local mock_eve_device_using_electrical_sensor = test .mock_device .build_test_matter_device ({
8158 profile = t_utils .get_profile_definition (" plug-energy-powerConsumption.yml" ),
@@ -135,7 +112,6 @@ local mock_eve_device_using_electrical_sensor = test.mock_device.build_test_matt
135112 }
136113 }
137114})
138- add_get_endpoints_to_mock (mock_eve_device_using_electrical_sensor )
139115
140116-- Mock device without Eve Private Cluster (should not match eve_energy sub-driver)
141117local mock_device_without_private_cluster = test .mock_device .build_test_matter_device ({
@@ -170,7 +146,6 @@ local mock_device_without_private_cluster = test.mock_device.build_test_matter_d
170146 }
171147 }
172148})
173- add_get_endpoints_to_mock (mock_device_without_private_cluster )
174149
175150local function test_init ()
176151 local cluster_subscribe_list = {
@@ -188,7 +163,6 @@ local function test_init()
188163end
189164test .set_test_init_function (test_init )
190165
191- -- Test can_handle logic
192166test .register_coroutine_test (
193167 " Eve Energy sub-driver can_handle should return true for devices with Eve Private Cluster and no Electrical Sensor" ,
194168 function ()
@@ -202,18 +176,6 @@ test.register_coroutine_test(
202176 }
203177)
204178
205- test .register_coroutine_test (
206- " Eve Energy sub-driver can_handle should return false for devices with Electrical Sensor device type" ,
207- function ()
208- local eve_energy_can_handle = require (" sub_drivers.eve_energy.can_handle" )
209- local result = eve_energy_can_handle (nil , nil , mock_eve_device_using_electrical_sensor )
210- assert (result == false , " can_handle should return false for Eve device with electrical sensor" )
211- end ,
212- {
213- min_api_version = 17
214- }
215- )
216-
217179test .register_coroutine_test (
218180 " Eve Energy sub-driver can_handle should return false for devices without Eve Private Cluster" ,
219181 function ()
0 commit comments