mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 17:57:11 +00:00
Format sharkiq with black (#39422)
This commit is contained in:
parent
be489e83a1
commit
4294d10789
@ -95,7 +95,9 @@ class SharkIqConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
return self.async_abort(reason=errors["base"])
|
return self.async_abort(reason=errors["base"])
|
||||||
|
|
||||||
return self.async_show_form(
|
return self.async_show_form(
|
||||||
step_id="reauth", data_schema=SHARKIQ_SCHEMA, errors=errors,
|
step_id="reauth",
|
||||||
|
data_schema=SHARKIQ_SCHEMA,
|
||||||
|
errors=errors,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -88,7 +88,9 @@ class SharkIqUpdateCoordinator(DataUpdateCoordinator):
|
|||||||
if not matching_flows:
|
if not matching_flows:
|
||||||
self.hass.async_create_task(
|
self.hass.async_create_task(
|
||||||
self.hass.config_entries.flow.async_init(
|
self.hass.config_entries.flow.async_init(
|
||||||
DOMAIN, context=flow_context, data=self._config_entry.data,
|
DOMAIN,
|
||||||
|
context=flow_context,
|
||||||
|
data=self._config_entry.data,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -31,10 +31,12 @@ async def test_form(hass):
|
|||||||
with patch("sharkiqpy.AylaApi.async_sign_in", return_value=True), patch(
|
with patch("sharkiqpy.AylaApi.async_sign_in", return_value=True), patch(
|
||||||
"homeassistant.components.sharkiq.async_setup", return_value=True
|
"homeassistant.components.sharkiq.async_setup", return_value=True
|
||||||
) as mock_setup, patch(
|
) as mock_setup, patch(
|
||||||
"homeassistant.components.sharkiq.async_setup_entry", return_value=True,
|
"homeassistant.components.sharkiq.async_setup_entry",
|
||||||
|
return_value=True,
|
||||||
) as mock_setup_entry:
|
) as mock_setup_entry:
|
||||||
result2 = await hass.config_entries.flow.async_configure(
|
result2 = await hass.config_entries.flow.async_configure(
|
||||||
result["flow_id"], CONFIG,
|
result["flow_id"],
|
||||||
|
CONFIG,
|
||||||
)
|
)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
@ -61,7 +63,8 @@ async def test_form_invalid_auth(hass):
|
|||||||
return_value=mocked_ayla,
|
return_value=mocked_ayla,
|
||||||
):
|
):
|
||||||
result2 = await hass.config_entries.flow.async_configure(
|
result2 = await hass.config_entries.flow.async_configure(
|
||||||
result["flow_id"], CONFIG,
|
result["flow_id"],
|
||||||
|
CONFIG,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert result2["type"] == "form"
|
assert result2["type"] == "form"
|
||||||
@ -80,7 +83,8 @@ async def test_form_cannot_connect(hass):
|
|||||||
return_value=mocked_ayla,
|
return_value=mocked_ayla,
|
||||||
):
|
):
|
||||||
result2 = await hass.config_entries.flow.async_configure(
|
result2 = await hass.config_entries.flow.async_configure(
|
||||||
result["flow_id"], CONFIG,
|
result["flow_id"],
|
||||||
|
CONFIG,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert result2["type"] == "form"
|
assert result2["type"] == "form"
|
||||||
@ -109,7 +113,8 @@ async def test_form_other_error(hass):
|
|||||||
async def test_reauth(hass):
|
async def test_reauth(hass):
|
||||||
"""Test reauth flow."""
|
"""Test reauth flow."""
|
||||||
with patch(
|
with patch(
|
||||||
"homeassistant.components.sharkiq.vacuum.async_setup_entry", return_value=True,
|
"homeassistant.components.sharkiq.vacuum.async_setup_entry",
|
||||||
|
return_value=True,
|
||||||
), patch("sharkiqpy.AylaApi.async_sign_in", return_value=True):
|
), patch("sharkiqpy.AylaApi.async_sign_in", return_value=True):
|
||||||
mock_config = MockConfigEntry(domain=DOMAIN, unique_id=UNIQUE_ID, data=CONFIG)
|
mock_config = MockConfigEntry(domain=DOMAIN, unique_id=UNIQUE_ID, data=CONFIG)
|
||||||
mock_config.add_to_hass(hass)
|
mock_config.add_to_hass(hass)
|
||||||
@ -124,14 +129,18 @@ async def test_reauth(hass):
|
|||||||
|
|
||||||
with patch("sharkiqpy.AylaApi.async_sign_in", side_effect=SharkIqAuthError):
|
with patch("sharkiqpy.AylaApi.async_sign_in", side_effect=SharkIqAuthError):
|
||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
DOMAIN, context={"source": "reauth", "unique_id": UNIQUE_ID}, data=CONFIG,
|
DOMAIN,
|
||||||
|
context={"source": "reauth", "unique_id": UNIQUE_ID},
|
||||||
|
data=CONFIG,
|
||||||
)
|
)
|
||||||
assert result["type"] == "form"
|
assert result["type"] == "form"
|
||||||
assert result["errors"] == {"base": "invalid_auth"}
|
assert result["errors"] == {"base": "invalid_auth"}
|
||||||
|
|
||||||
with patch("sharkiqpy.AylaApi.async_sign_in", side_effect=RuntimeError):
|
with patch("sharkiqpy.AylaApi.async_sign_in", side_effect=RuntimeError):
|
||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
DOMAIN, context={"source": "reauth", "unique_id": UNIQUE_ID}, data=CONFIG,
|
DOMAIN,
|
||||||
|
context={"source": "reauth", "unique_id": UNIQUE_ID},
|
||||||
|
data=CONFIG,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert result["type"] == "abort"
|
assert result["type"] == "abort"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user