Upgrade black to 20.8b1 (#39287)
This commit is contained in:
1 parent
0d7eec710c
commit
1c2ebdf307
574 files changed
+4389
-1725
No files matched your search
@@ -55,19 +55,28 @@ def mock_connection(
|
||||
"""Mock Sonarr connection."""
|
||||
if error:
|
||||
mock_connection_error(
|
||||
aioclient_mock, host=host, port=port, base_path=base_path,
|
||||
aioclient_mock,
|
||||
host=host,
|
||||
port=port,
|
||||
base_path=base_path,
|
||||
)
|
||||
return
|
||||
|
||||
if invalid_auth:
|
||||
mock_connection_invalid_auth(
|
||||
aioclient_mock, host=host, port=port, base_path=base_path,
|
||||
aioclient_mock,
|
||||
host=host,
|
||||
port=port,
|
||||
base_path=base_path,
|
||||
)
|
||||
return
|
||||
|
||||
if server_error:
|
||||
mock_connection_server_error(
|
||||
aioclient_mock, host=host, port=port, base_path=base_path,
|
||||
aioclient_mock,
|
||||
host=host,
|
||||
port=port,
|
||||
base_path=base_path,
|
||||
)
|
||||
return
|
||||
|
||||
@@ -232,5 +241,6 @@ def _patch_async_setup(return_value=True):
|
||||
def _patch_async_setup_entry(return_value=True):
|
||||
"""Patch the async entry setup of sonarr."""
|
||||
return patch(
|
||||
"homeassistant.components.sonarr.async_setup_entry", return_value=return_value,
|
||||
"homeassistant.components.sonarr.async_setup_entry",
|
||||
return_value=return_value,
|
||||
)
|
||||
@@ -32,7 +32,8 @@ from tests.test_util.aiohttp import AiohttpClientMocker
|
||||
async def test_show_user_form(hass: HomeAssistantType) -> None:
|
||||
"""Test that the user set up form is served."""
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={CONF_SOURCE: SOURCE_USER},
|
||||
DOMAIN,
|
||||
context={CONF_SOURCE: SOURCE_USER},
|
||||
)
|
||||
|
||||
assert result["step_id"] == "user"
|
||||
@@ -47,7 +48,9 @@ async def test_cannot_connect(
|
||||
|
||||
user_input = MOCK_USER_INPUT.copy()
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={CONF_SOURCE: SOURCE_USER}, data=user_input,
|
||||
DOMAIN,
|
||||
context={CONF_SOURCE: SOURCE_USER},
|
||||
data=user_input,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
@@ -63,7 +66,9 @@ async def test_invalid_auth(
|
||||
|
||||
user_input = MOCK_USER_INPUT.copy()
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={CONF_SOURCE: SOURCE_USER}, data=user_input,
|
||||
DOMAIN,
|
||||
context={CONF_SOURCE: SOURCE_USER},
|
||||
data=user_input,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
@@ -81,7 +86,9 @@ async def test_unknown_error(
|
||||
side_effect=Exception,
|
||||
):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={CONF_SOURCE: SOURCE_USER}, data=user_input,
|
||||
DOMAIN,
|
||||
context={CONF_SOURCE: SOURCE_USER},
|
||||
data=user_input,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
@@ -98,7 +105,9 @@ async def test_full_import_flow_implementation(
|
||||
|
||||
with _patch_async_setup(), _patch_async_setup_entry():
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={CONF_SOURCE: SOURCE_IMPORT}, data=user_input,
|
||||
DOMAIN,
|
||||
context={CONF_SOURCE: SOURCE_IMPORT},
|
||||
data=user_input,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
@@ -115,7 +124,8 @@ async def test_full_user_flow_implementation(
|
||||
mock_connection(aioclient_mock)
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={CONF_SOURCE: SOURCE_USER},
|
||||
DOMAIN,
|
||||
context={CONF_SOURCE: SOURCE_USER},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
@@ -125,7 +135,8 @@ async def test_full_user_flow_implementation(
|
||||
|
||||
with _patch_async_setup(), _patch_async_setup_entry():
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input=user_input,
|
||||
result["flow_id"],
|
||||
user_input=user_input,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
@@ -155,7 +166,8 @@ async def test_full_user_flow_advanced_options(
|
||||
|
||||
with _patch_async_setup(), _patch_async_setup_entry():
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input=user_input,
|
||||
result["flow_id"],
|
||||
user_input=user_input,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
|
||||
@@ -25,7 +25,8 @@ async def test_unload_config_entry(
|
||||
) -> None:
|
||||
"""Test the configuration entry unloading."""
|
||||
with patch(
|
||||
"homeassistant.components.sonarr.sensor.async_setup_entry", return_value=True,
|
||||
"homeassistant.components.sonarr.sensor.async_setup_entry",
|
||||
return_value=True,
|
||||
):
|
||||
entry = await setup_integration(hass, aioclient_mock)
|
||||
|
||||
|
||||
Reference in new issue
Block a user