mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 17:57:11 +00:00
Address late review of nsw fuel station (#51619)
This commit is contained in:
parent
fa42c676bb
commit
3fa6c97801
@ -7,7 +7,7 @@ import logging
|
|||||||
|
|
||||||
from nsw_fuel import FuelCheckClient, FuelCheckError, Station
|
from nsw_fuel import FuelCheckClient, FuelCheckError, Station
|
||||||
|
|
||||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
|
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
||||||
|
|
||||||
from .const import DATA_NSW_FUEL_STATION
|
from .const import DATA_NSW_FUEL_STATION
|
||||||
|
|
||||||
@ -60,5 +60,6 @@ def fetch_station_price_data(client: FuelCheckClient) -> StationPriceData | None
|
|||||||
)
|
)
|
||||||
|
|
||||||
except FuelCheckError as exc:
|
except FuelCheckError as exc:
|
||||||
_LOGGER.error("Failed to fetch NSW Fuel station price data. %s", exc)
|
raise UpdateFailed(
|
||||||
return None
|
f"Failed to fetch NSW Fuel station price data: {exc}"
|
||||||
|
) from exc
|
||||||
|
@ -75,7 +75,6 @@ MOCK_FUEL_PRICES_RESPONSE = MockGetFuelPricesResponse(
|
|||||||
)
|
)
|
||||||
async def test_setup(get_fuel_prices, hass):
|
async def test_setup(get_fuel_prices, hass):
|
||||||
"""Test the setup with custom settings."""
|
"""Test the setup with custom settings."""
|
||||||
assert await async_setup_component(hass, DOMAIN, {})
|
|
||||||
with assert_setup_component(1, sensor.DOMAIN):
|
with assert_setup_component(1, sensor.DOMAIN):
|
||||||
assert await async_setup_component(
|
assert await async_setup_component(
|
||||||
hass, sensor.DOMAIN, {"sensor": VALID_CONFIG}
|
hass, sensor.DOMAIN, {"sensor": VALID_CONFIG}
|
||||||
@ -98,7 +97,6 @@ def raise_fuel_check_error():
|
|||||||
)
|
)
|
||||||
async def test_setup_error(get_fuel_prices, hass):
|
async def test_setup_error(get_fuel_prices, hass):
|
||||||
"""Test the setup with client throwing error."""
|
"""Test the setup with client throwing error."""
|
||||||
assert await async_setup_component(hass, DOMAIN, {})
|
|
||||||
with assert_setup_component(1, sensor.DOMAIN):
|
with assert_setup_component(1, sensor.DOMAIN):
|
||||||
assert await async_setup_component(
|
assert await async_setup_component(
|
||||||
hass, sensor.DOMAIN, {"sensor": VALID_CONFIG}
|
hass, sensor.DOMAIN, {"sensor": VALID_CONFIG}
|
||||||
@ -116,7 +114,6 @@ async def test_setup_error(get_fuel_prices, hass):
|
|||||||
)
|
)
|
||||||
async def test_setup_error_no_station(get_fuel_prices, hass):
|
async def test_setup_error_no_station(get_fuel_prices, hass):
|
||||||
"""Test the setup with specified station not existing."""
|
"""Test the setup with specified station not existing."""
|
||||||
assert await async_setup_component(hass, DOMAIN, {})
|
|
||||||
with assert_setup_component(2, sensor.DOMAIN):
|
with assert_setup_component(2, sensor.DOMAIN):
|
||||||
assert await async_setup_component(
|
assert await async_setup_component(
|
||||||
hass,
|
hass,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user