22import sys
33from unittest import mock
44from sonic_platform .liquid_cooling import LiquidCooling , LeakageSensor
5+ from sonic_platform .utils import read_int_from_file
56
67def test_leakage_sensor_init ():
78 sensor = LeakageSensor ("leakage1" , "/test/path" )
@@ -31,7 +32,8 @@ def test_leakage_sensor_is_leak():
3132def test_liquid_cooling_init ():
3233 with mock .patch ('os.path.exists' ) as mock_exists , \
3334 mock .patch ('os.path.join' , side_effect = lambda * args : "/" .join (args )) as mock_join , \
34- mock .patch ('glob.glob' ) as mock_glob :
35+ mock .patch ('glob.glob' ) as mock_glob , \
36+ mock .patch ('sonic_platform.utils.read_int_from_file' , return_value = 4 ) as mock_read_int :
3537
3638 # Setup mock to simulate 4 leakage sensors
3739 mock_exists .side_effect = [True , True , True , True ]
@@ -45,7 +47,7 @@ def test_liquid_cooling_init():
4547 liquid_cooling = LiquidCooling ()
4648
4749 # Verify the number of sensors initialized
48- assert liquid_cooling .leakage_sensors_num == 4
50+ assert liquid_cooling .get_leak_sensor_num () == 4
4951
5052
5153 with mock .patch .object (liquid_cooling .leakage_sensors [3 ], 'is_leak' , return_value = False ) as mock_sensor1 :
0 commit comments