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
@@ -25,7 +25,8 @@ from tests.common import MockConfigEntry
|
||||
def mock_setup():
|
||||
"""Mock entry setup."""
|
||||
with patch(
|
||||
"homeassistant.components.speedtestdotnet.async_setup_entry", return_value=True,
|
||||
"homeassistant.components.speedtestdotnet.async_setup_entry",
|
||||
return_value=True,
|
||||
):
|
||||
yield
|
||||
|
||||
@@ -88,7 +89,12 @@ async def test_import_success(hass, mock_setup):
|
||||
|
||||
async def test_options(hass):
|
||||
"""Test updating options."""
|
||||
entry = MockConfigEntry(domain=DOMAIN, title="SpeedTest", data={}, options={},)
|
||||
entry = MockConfigEntry(
|
||||
domain=DOMAIN,
|
||||
title="SpeedTest",
|
||||
data={},
|
||||
options={},
|
||||
)
|
||||
entry.add_to_hass(hass)
|
||||
|
||||
with patch("speedtest.Speedtest") as mock_api:
|
||||
@@ -119,7 +125,11 @@ async def test_options(hass):
|
||||
|
||||
async def test_integration_already_configured(hass):
|
||||
"""Test integration is already configured."""
|
||||
entry = MockConfigEntry(domain=DOMAIN, data={}, options={},)
|
||||
entry = MockConfigEntry(
|
||||
domain=DOMAIN,
|
||||
data={},
|
||||
options={},
|
||||
)
|
||||
entry.add_to_hass(hass)
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
speedtestdotnet.DOMAIN, context={"source": "user"}
|
||||
|
||||
@@ -25,7 +25,10 @@ async def test_setup_with_config(hass):
|
||||
async def test_successful_config_entry(hass):
|
||||
"""Test that SpeedTestDotNet is configured successfully."""
|
||||
|
||||
entry = MockConfigEntry(domain=speedtestdotnet.DOMAIN, data={},)
|
||||
entry = MockConfigEntry(
|
||||
domain=speedtestdotnet.DOMAIN,
|
||||
data={},
|
||||
)
|
||||
entry.add_to_hass(hass)
|
||||
|
||||
with patch("speedtest.Speedtest"), patch(
|
||||
@@ -35,13 +38,19 @@ async def test_successful_config_entry(hass):
|
||||
await hass.config_entries.async_setup(entry.entry_id)
|
||||
|
||||
assert entry.state == config_entries.ENTRY_STATE_LOADED
|
||||
assert forward_entry_setup.mock_calls[0][1] == (entry, "sensor",)
|
||||
assert forward_entry_setup.mock_calls[0][1] == (
|
||||
entry,
|
||||
"sensor",
|
||||
)
|
||||
|
||||
|
||||
async def test_setup_failed(hass):
|
||||
"""Test SpeedTestDotNet failed due to an error."""
|
||||
|
||||
entry = MockConfigEntry(domain=speedtestdotnet.DOMAIN, data={},)
|
||||
entry = MockConfigEntry(
|
||||
domain=speedtestdotnet.DOMAIN,
|
||||
data={},
|
||||
)
|
||||
entry.add_to_hass(hass)
|
||||
|
||||
with patch("speedtest.Speedtest", side_effect=speedtest.ConfigRetrievalError):
|
||||
@@ -53,7 +62,10 @@ async def test_setup_failed(hass):
|
||||
|
||||
async def test_unload_entry(hass):
|
||||
"""Test removing SpeedTestDotNet."""
|
||||
entry = MockConfigEntry(domain=speedtestdotnet.DOMAIN, data={},)
|
||||
entry = MockConfigEntry(
|
||||
domain=speedtestdotnet.DOMAIN,
|
||||
data={},
|
||||
)
|
||||
entry.add_to_hass(hass)
|
||||
|
||||
with patch("speedtest.Speedtest"):
|
||||
|
||||
Reference in new issue
Block a user