mirror of
https://github.com/Electric-Special/ha-core.git
synced 2026-03-21 03:03:17 +01:00
Pump pysaunum to 0.5.0 (#163021)
This commit is contained in:
@@ -8,5 +8,5 @@
|
|||||||
"iot_class": "local_polling",
|
"iot_class": "local_polling",
|
||||||
"loggers": ["pysaunum"],
|
"loggers": ["pysaunum"],
|
||||||
"quality_scale": "platinum",
|
"quality_scale": "platinum",
|
||||||
"requirements": ["pysaunum==0.3.0"]
|
"requirements": ["pysaunum==0.5.0"]
|
||||||
}
|
}
|
||||||
|
|||||||
2
requirements_all.txt
generated
2
requirements_all.txt
generated
@@ -2408,7 +2408,7 @@ pysabnzbd==1.1.1
|
|||||||
pysaj==0.0.16
|
pysaj==0.0.16
|
||||||
|
|
||||||
# homeassistant.components.saunum
|
# homeassistant.components.saunum
|
||||||
pysaunum==0.3.0
|
pysaunum==0.5.0
|
||||||
|
|
||||||
# homeassistant.components.schlage
|
# homeassistant.components.schlage
|
||||||
pyschlage==2025.9.0
|
pyschlage==2025.9.0
|
||||||
|
|||||||
2
requirements_test_all.txt
generated
2
requirements_test_all.txt
generated
@@ -2046,7 +2046,7 @@ pyrympro==0.0.9
|
|||||||
pysabnzbd==1.1.1
|
pysabnzbd==1.1.1
|
||||||
|
|
||||||
# homeassistant.components.saunum
|
# homeassistant.components.saunum
|
||||||
pysaunum==0.3.0
|
pysaunum==0.5.0
|
||||||
|
|
||||||
# homeassistant.components.schlage
|
# homeassistant.components.schlage
|
||||||
pyschlage==2025.9.0
|
pyschlage==2025.9.0
|
||||||
|
|||||||
@@ -105,13 +105,19 @@ async def test_climate_service_calls(
|
|||||||
getattr(mock_saunum_client, client_method).assert_called_once_with(*expected_args)
|
getattr(mock_saunum_client, client_method).assert_called_once_with(*expected_args)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.usefixtures("init_integration")
|
|
||||||
async def test_hvac_mode_door_open_validation(
|
async def test_hvac_mode_door_open_validation(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
mock_config_entry: MockConfigEntry,
|
||||||
mock_saunum_client,
|
mock_saunum_client,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test HVAC mode validation error when door is open."""
|
"""Test HVAC mode validation error when door is open."""
|
||||||
mock_saunum_client.async_get_data.return_value.door_open = True
|
mock_saunum_client.async_get_data.return_value = replace(
|
||||||
|
mock_saunum_client.async_get_data.return_value, door_open=True
|
||||||
|
)
|
||||||
|
|
||||||
|
mock_config_entry.add_to_hass(hass)
|
||||||
|
assert await hass.config_entries.async_setup(mock_config_entry.entry_id)
|
||||||
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
with pytest.raises(
|
with pytest.raises(
|
||||||
ServiceValidationError,
|
ServiceValidationError,
|
||||||
@@ -140,9 +146,10 @@ async def test_hvac_actions(
|
|||||||
expected_hvac_action: HVACAction,
|
expected_hvac_action: HVACAction,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test HVAC actions when session is active."""
|
"""Test HVAC actions when session is active."""
|
||||||
mock_saunum_client.async_get_data.return_value.session_active = True
|
mock_saunum_client.async_get_data.return_value = replace(
|
||||||
mock_saunum_client.async_get_data.return_value.heater_elements_active = (
|
mock_saunum_client.async_get_data.return_value,
|
||||||
heater_elements_active
|
session_active=True,
|
||||||
|
heater_elements_active=heater_elements_active,
|
||||||
)
|
)
|
||||||
|
|
||||||
mock_config_entry.add_to_hass(hass)
|
mock_config_entry.add_to_hass(hass)
|
||||||
@@ -275,13 +282,19 @@ async def test_service_error_handling(
|
|||||||
assert exc_info.value.translation_domain == "saunum"
|
assert exc_info.value.translation_domain == "saunum"
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.usefixtures("init_integration")
|
|
||||||
async def test_fan_mode_service_call(
|
async def test_fan_mode_service_call(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
mock_config_entry: MockConfigEntry,
|
||||||
mock_saunum_client,
|
mock_saunum_client,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test setting fan mode."""
|
"""Test setting fan mode."""
|
||||||
mock_saunum_client.async_get_data.return_value.session_active = True
|
mock_saunum_client.async_get_data.return_value = replace(
|
||||||
|
mock_saunum_client.async_get_data.return_value, session_active=True
|
||||||
|
)
|
||||||
|
|
||||||
|
mock_config_entry.add_to_hass(hass)
|
||||||
|
assert await hass.config_entries.async_setup(mock_config_entry.entry_id)
|
||||||
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
CLIMATE_DOMAIN,
|
CLIMATE_DOMAIN,
|
||||||
@@ -327,8 +340,11 @@ async def test_fan_mode_attributes(
|
|||||||
fan_mode: str | None,
|
fan_mode: str | None,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test fan mode attribute mapping from device."""
|
"""Test fan mode attribute mapping from device."""
|
||||||
mock_saunum_client.async_get_data.return_value.fan_speed = fan_speed
|
mock_saunum_client.async_get_data.return_value = replace(
|
||||||
mock_saunum_client.async_get_data.return_value.session_active = True
|
mock_saunum_client.async_get_data.return_value,
|
||||||
|
fan_speed=fan_speed,
|
||||||
|
session_active=True,
|
||||||
|
)
|
||||||
|
|
||||||
mock_config_entry.add_to_hass(hass)
|
mock_config_entry.add_to_hass(hass)
|
||||||
assert await hass.config_entries.async_setup(mock_config_entry.entry_id)
|
assert await hass.config_entries.async_setup(mock_config_entry.entry_id)
|
||||||
@@ -342,11 +358,8 @@ async def test_fan_mode_attributes(
|
|||||||
@pytest.mark.usefixtures("init_integration")
|
@pytest.mark.usefixtures("init_integration")
|
||||||
async def test_fan_mode_validation_error(
|
async def test_fan_mode_validation_error(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
mock_saunum_client,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test fan mode validation error when session is not active."""
|
"""Test fan mode validation error when session is not active."""
|
||||||
mock_saunum_client.async_get_data.return_value.session_active = False
|
|
||||||
|
|
||||||
with pytest.raises(
|
with pytest.raises(
|
||||||
ServiceValidationError,
|
ServiceValidationError,
|
||||||
match="Cannot change fan mode when sauna session is not active",
|
match="Cannot change fan mode when sauna session is not active",
|
||||||
@@ -359,13 +372,19 @@ async def test_fan_mode_validation_error(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.usefixtures("init_integration")
|
|
||||||
async def test_preset_mode_validation_error(
|
async def test_preset_mode_validation_error(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
mock_config_entry: MockConfigEntry,
|
||||||
mock_saunum_client,
|
mock_saunum_client,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test preset mode validation error when session is active."""
|
"""Test preset mode validation error when session is active."""
|
||||||
mock_saunum_client.async_get_data.return_value.session_active = True
|
mock_saunum_client.async_get_data.return_value = replace(
|
||||||
|
mock_saunum_client.async_get_data.return_value, session_active=True
|
||||||
|
)
|
||||||
|
|
||||||
|
mock_config_entry.add_to_hass(hass)
|
||||||
|
assert await hass.config_entries.async_setup(mock_config_entry.entry_id)
|
||||||
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
with pytest.raises(ServiceValidationError) as exc_info:
|
with pytest.raises(ServiceValidationError) as exc_info:
|
||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
@@ -396,7 +415,9 @@ async def test_preset_mode_attributes_default_names(
|
|||||||
expected_preset: str,
|
expected_preset: str,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test preset mode attributes with default names."""
|
"""Test preset mode attributes with default names."""
|
||||||
mock_saunum_client.async_get_data.return_value.sauna_type = sauna_type
|
mock_saunum_client.async_get_data.return_value = replace(
|
||||||
|
mock_saunum_client.async_get_data.return_value, sauna_type=sauna_type
|
||||||
|
)
|
||||||
|
|
||||||
mock_config_entry.add_to_hass(hass)
|
mock_config_entry.add_to_hass(hass)
|
||||||
assert await hass.config_entries.async_setup(mock_config_entry.entry_id)
|
assert await hass.config_entries.async_setup(mock_config_entry.entry_id)
|
||||||
@@ -423,7 +444,9 @@ async def test_preset_mode_attributes_custom_names(
|
|||||||
options=custom_options,
|
options=custom_options,
|
||||||
title="Saunum",
|
title="Saunum",
|
||||||
)
|
)
|
||||||
mock_saunum_client.async_get_data.return_value.sauna_type = 1
|
mock_saunum_client.async_get_data.return_value = replace(
|
||||||
|
mock_saunum_client.async_get_data.return_value, sauna_type=1
|
||||||
|
)
|
||||||
|
|
||||||
mock_config_entry.add_to_hass(hass)
|
mock_config_entry.add_to_hass(hass)
|
||||||
assert await hass.config_entries.async_setup(mock_config_entry.entry_id)
|
assert await hass.config_entries.async_setup(mock_config_entry.entry_id)
|
||||||
@@ -483,16 +506,21 @@ async def test_preset_mode_options_update(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.usefixtures("init_integration")
|
|
||||||
async def test_fan_mode_error_handling(
|
async def test_fan_mode_error_handling(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
mock_config_entry: MockConfigEntry,
|
||||||
mock_saunum_client,
|
mock_saunum_client,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test error handling when setting fan mode fails."""
|
"""Test error handling when setting fan mode fails."""
|
||||||
entity_id = "climate.saunum_leil"
|
entity_id = "climate.saunum_leil"
|
||||||
|
|
||||||
# Ensure session is active
|
mock_saunum_client.async_get_data.return_value = replace(
|
||||||
mock_saunum_client.async_get_data.return_value.session_active = True
|
mock_saunum_client.async_get_data.return_value, session_active=True
|
||||||
|
)
|
||||||
|
|
||||||
|
mock_config_entry.add_to_hass(hass)
|
||||||
|
assert await hass.config_entries.async_setup(mock_config_entry.entry_id)
|
||||||
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
# Make the client method raise an exception
|
# Make the client method raise an exception
|
||||||
mock_saunum_client.async_set_fan_speed.side_effect = SaunumException(
|
mock_saunum_client.async_set_fan_speed.side_effect = SaunumException(
|
||||||
|
|||||||
Reference in New Issue
Block a user