Skip to content

Commit

Permalink
Fix async_mock_service calls
Browse files Browse the repository at this point in the history
  • Loading branch information
Limych committed May 9, 2024
1 parent 9b7902f commit a8bcf86
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion custom_components/snowtire/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# Base component constants
NAME: Final = "Snowtire Sensor"
DOMAIN: Final = "snowtire"
VERSION: Final = "1.4.8"
VERSION: Final = "1.4.9-alpha"
ISSUE_URL: Final = "https://github.com/Limych/ha-snowtire/issues"

STARTUP_MESSAGE: Final = f"""
Expand Down
2 changes: 1 addition & 1 deletion custom_components/snowtire/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
"iot_class": "calculated",
"issue_tracker": "https://github.com/Limych/ha-snowtire/issues",
"requirements": [],
"version": "1.4.8"
"version": "1.4.9-alpha"
}
9 changes: 5 additions & 4 deletions tests/test_binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
ATTR_FORECAST_TEMP_LOW,
ATTR_FORECAST_TIME,
ATTR_WEATHER_TEMPERATURE,
DOMAIN as WEATHER_DOMAIN,
SERVICE_GET_FORECASTS,
WeatherEntityFeature,
)
Expand All @@ -31,7 +32,7 @@
CONF_PLATFORM,
UnitOfTemperature,
)
from homeassistant.core import HomeAssistant, State, SupportsResponse
from homeassistant.core import HomeAssistant, SupportsResponse
from homeassistant.exceptions import HomeAssistantError
from homeassistant.util import dt as dt_util

Expand Down Expand Up @@ -107,7 +108,7 @@ async def test_async_update_forecast_fail(hass: HomeAssistant, default_sensor):
"""Test sensor update on forecast fail."""
async_mock_service(
hass,
CONF_WEATHER,
WEATHER_DOMAIN,
SERVICE_GET_FORECASTS,
supports_response=SupportsResponse.OPTIONAL,
)
Expand Down Expand Up @@ -166,7 +167,7 @@ async def test_async_update_forecast_fail(hass: HomeAssistant, default_sensor):

async def test_async_update(hass: HomeAssistant, default_sensor):
"""Test sensor update."""
hass.states._states[MOCK_WEATHER_ENTITY] = State(MOCK_WEATHER_ENTITY, None)
hass.states.async_set(MOCK_WEATHER_ENTITY, None)

with raises(HomeAssistantError):
await default_sensor.async_update()
Expand Down Expand Up @@ -202,7 +203,7 @@ async def test_async_update(hass: HomeAssistant, default_sensor):
}
}

async_mock_service(hass, CONF_WEATHER, SERVICE_GET_FORECASTS, response=forecast)
async_mock_service(hass, WEATHER_DOMAIN, SERVICE_GET_FORECASTS, response=forecast)

hass.states.async_set(
MOCK_WEATHER_ENTITY,
Expand Down

0 comments on commit a8bcf86

Please sign in to comment.