@@ -72,15 +72,32 @@ async def test_set_co2_sensor_control_with_invalid_profile(vallox):
7272 await vallox .set_co2_sensor_control (Profile .EXTRA , True )
7373
7474
75+ @pytest .mark .parametrize (
76+ "mode, expected" ,
77+ [
78+ (True , 1 ),
79+ (False , 0 ),
80+ (1 , 1 ),
81+ (0 , 0 ),
82+ ],
83+ )
7584@pytest .mark .asyncio
76- async def test_set_sensor_control_mode_and_limits (vallox ):
85+ async def test_set_sensor_control_mode (vallox , mode , expected ):
7786 """Test setting sensor control modes and limits."""
7887 vallox .set_values = mock .AsyncMock ()
7988
80- # Test setting RH sensor mode
81- await vallox .set_rh_sensor_control_mode (1 ) # Manual mode
82- vallox .set_values .assert_called_once_with ({"A_CYC_RH_LEVEL_MODE" : 1 })
83- vallox .set_values .reset_mock ()
89+ await vallox .set_rh_sensor_manual_control_mode (mode ) # Manual mode
90+ vallox .set_values .assert_called_once_with ({"A_CYC_RH_LEVEL_MODE" : expected })
91+
92+ # Test invalid RH sensor mode
93+ with pytest .raises (ValloxInvalidInputException ):
94+ await vallox .set_rh_sensor_manual_control_mode (2 )
95+
96+
97+ @pytest .mark .asyncio
98+ async def test_set_sensor_control_limits (vallox ):
99+ """Test setting sensor control modes and limits."""
100+ vallox .set_values = mock .AsyncMock ()
84101
85102 # Test setting RH sensor limit
86103 await vallox .set_rh_sensor_limit (65 )
@@ -92,10 +109,6 @@ async def test_set_sensor_control_mode_and_limits(vallox):
92109 vallox .set_values .assert_called_once_with ({"A_CYC_CO2_THRESHOLD" : 1000 })
93110 vallox .set_values .reset_mock ()
94111
95- # Test invalid RH sensor mode
96- with pytest .raises (ValloxInvalidInputException ):
97- await vallox .set_rh_sensor_control_mode (2 )
98-
99112 # Test invalid RH sensor limit
100113 with pytest .raises (ValloxInvalidInputException ):
101114 await vallox .set_rh_sensor_limit (101 )
@@ -254,7 +267,10 @@ async def test_get_sensor_controls_and_modes(vallox, metrics_response):
254267 )
255268
256269 # Test sensor modes and limits
257- assert data .rh_sensor_control_mode == metrics_response ["A_CYC_RH_LEVEL_MODE" ]
270+ assert isinstance (data .rh_sensor_manual_control_mode , bool )
271+ assert data .rh_sensor_manual_control_mode == bool (
272+ metrics_response ["A_CYC_RH_LEVEL_MODE" ]
273+ )
258274 assert data .rh_sensor_limit == metrics_response ["A_CYC_RH_BASIC_LEVEL" ]
259275 assert data .co2_sensor_limit == metrics_response ["A_CYC_CO2_THRESHOLD" ]
260276
0 commit comments