mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 09:17:10 +00:00
Prevent opening of sockets in mqtt tests (#57101)
This commit is contained in:
parent
2059cbacbd
commit
f548d1dba7
@ -29,7 +29,9 @@ def mock_try_connection():
|
|||||||
yield mock_try
|
yield mock_try
|
||||||
|
|
||||||
|
|
||||||
async def test_user_connection_works(hass, mock_try_connection, mock_finish_setup):
|
async def test_user_connection_works(
|
||||||
|
hass, mock_try_connection, mock_finish_setup, mqtt_client_mock
|
||||||
|
):
|
||||||
"""Test we can finish a config flow."""
|
"""Test we can finish a config flow."""
|
||||||
mock_try_connection.return_value = True
|
mock_try_connection.return_value = True
|
||||||
|
|
||||||
@ -76,7 +78,9 @@ async def test_user_connection_fails(hass, mock_try_connection, mock_finish_setu
|
|||||||
assert len(mock_finish_setup.mock_calls) == 0
|
assert len(mock_finish_setup.mock_calls) == 0
|
||||||
|
|
||||||
|
|
||||||
async def test_manual_config_set(hass, mock_try_connection, mock_finish_setup):
|
async def test_manual_config_set(
|
||||||
|
hass, mock_try_connection, mock_finish_setup, mqtt_client_mock
|
||||||
|
):
|
||||||
"""Test we ignore entry if manual config available."""
|
"""Test we ignore entry if manual config available."""
|
||||||
assert await async_setup_component(hass, "mqtt", {"mqtt": {"broker": "bla"}})
|
assert await async_setup_component(hass, "mqtt", {"mqtt": {"broker": "bla"}})
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
@ -128,7 +132,9 @@ async def test_hassio_ignored(hass: HomeAssistant) -> None:
|
|||||||
assert result.get("reason") == "already_configured"
|
assert result.get("reason") == "already_configured"
|
||||||
|
|
||||||
|
|
||||||
async def test_hassio_confirm(hass, mock_try_connection, mock_finish_setup):
|
async def test_hassio_confirm(
|
||||||
|
hass, mock_try_connection, mock_finish_setup, mqtt_client_mock
|
||||||
|
):
|
||||||
"""Test we can finish a config flow."""
|
"""Test we can finish a config flow."""
|
||||||
mock_try_connection.return_value = True
|
mock_try_connection.return_value = True
|
||||||
|
|
||||||
@ -464,6 +470,9 @@ async def test_option_flow_default_suggested_values(
|
|||||||
)
|
)
|
||||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||||
|
|
||||||
|
# Make sure all MQTT related jobs are done before ending the test
|
||||||
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
|
|
||||||
async def test_options_user_connection_fails(hass, mock_try_connection):
|
async def test_options_user_connection_fails(hass, mock_try_connection):
|
||||||
"""Test if connection cannot be made."""
|
"""Test if connection cannot be made."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user