mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Use load_json_object in tellduslive (#88591)
This commit is contained in:
parent
3c1e62aeef
commit
79adfbc862
@ -9,7 +9,7 @@ import voluptuous as vol
|
|||||||
|
|
||||||
from homeassistant import config_entries
|
from homeassistant import config_entries
|
||||||
from homeassistant.const import CONF_HOST
|
from homeassistant.const import CONF_HOST
|
||||||
from homeassistant.util.json import load_json
|
from homeassistant.util.json import load_json_object
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
APPLICATION_NAME,
|
APPLICATION_NAME,
|
||||||
@ -137,7 +137,7 @@ class FlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
return await self.async_step_user()
|
return await self.async_step_user()
|
||||||
|
|
||||||
conf = await self.hass.async_add_executor_job(
|
conf = await self.hass.async_add_executor_job(
|
||||||
load_json, self.hass.config.path(TELLDUS_CONFIG_FILE)
|
load_json_object, self.hass.config.path(TELLDUS_CONFIG_FILE)
|
||||||
)
|
)
|
||||||
host = next(iter(conf))
|
host = next(iter(conf))
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ async def test_step_import_load_json_matching_host(
|
|||||||
flow = init_config_flow(hass)
|
flow = init_config_flow(hass)
|
||||||
|
|
||||||
with patch(
|
with patch(
|
||||||
"homeassistant.components.tellduslive.config_flow.load_json",
|
"homeassistant.components.tellduslive.config_flow.load_json_object",
|
||||||
return_value={"tellduslive": {}},
|
return_value={"tellduslive": {}},
|
||||||
), patch("os.path.isfile"):
|
), patch("os.path.isfile"):
|
||||||
result = await flow.async_step_import(
|
result = await flow.async_step_import(
|
||||||
@ -156,7 +156,7 @@ async def test_step_import_load_json(hass: HomeAssistant, mock_tellduslive) -> N
|
|||||||
flow = init_config_flow(hass)
|
flow = init_config_flow(hass)
|
||||||
|
|
||||||
with patch(
|
with patch(
|
||||||
"homeassistant.components.tellduslive.config_flow.load_json",
|
"homeassistant.components.tellduslive.config_flow.load_json_object",
|
||||||
return_value={"localhost": {}},
|
return_value={"localhost": {}},
|
||||||
), patch("os.path.isfile"):
|
), patch("os.path.isfile"):
|
||||||
result = await flow.async_step_import(
|
result = await flow.async_step_import(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user