mirror of
https://github.com/home-assistant/core.git
synced 2025-07-10 06:47:09 +00:00
Fix timeout in purpleapi test (#88715)
https://github.com/home-assistant/core/actions/runs/4264644494/jobs/7423099757
This commit is contained in:
parent
0c6a469218
commit
2d6f84b2a8
@ -75,7 +75,7 @@ async def mock_aiopurpleair_fixture(api):
|
|||||||
with patch(
|
with patch(
|
||||||
"homeassistant.components.purpleair.config_flow.API", return_value=api
|
"homeassistant.components.purpleair.config_flow.API", return_value=api
|
||||||
), patch("homeassistant.components.purpleair.coordinator.API", return_value=api):
|
), patch("homeassistant.components.purpleair.coordinator.API", return_value=api):
|
||||||
yield
|
yield api
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(name="setup_config_entry")
|
@pytest.fixture(name="setup_config_entry")
|
||||||
|
@ -123,7 +123,7 @@ async def test_duplicate_error(
|
|||||||
)
|
)
|
||||||
async def test_reauth(
|
async def test_reauth(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
api,
|
mock_aiopurpleair,
|
||||||
check_api_key_errors,
|
check_api_key_errors,
|
||||||
check_api_key_mock,
|
check_api_key_mock,
|
||||||
config_entry,
|
config_entry,
|
||||||
@ -143,7 +143,7 @@ async def test_reauth(
|
|||||||
assert result["step_id"] == "reauth_confirm"
|
assert result["step_id"] == "reauth_confirm"
|
||||||
|
|
||||||
# Test errors that can arise when checking the API key:
|
# Test errors that can arise when checking the API key:
|
||||||
with patch.object(api, "async_check_api_key", check_api_key_mock):
|
with patch.object(mock_aiopurpleair, "async_check_api_key", check_api_key_mock):
|
||||||
result = await hass.config_entries.flow.async_configure(
|
result = await hass.config_entries.flow.async_configure(
|
||||||
result["flow_id"], user_input={"api_key": "new_api_key"}
|
result["flow_id"], user_input={"api_key": "new_api_key"}
|
||||||
)
|
)
|
||||||
@ -157,6 +157,9 @@ async def test_reauth(
|
|||||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||||
assert result["reason"] == "reauth_successful"
|
assert result["reason"] == "reauth_successful"
|
||||||
assert len(hass.config_entries.async_entries()) == 1
|
assert len(hass.config_entries.async_entries()) == 1
|
||||||
|
# Unload to make sure the update does not run after the
|
||||||
|
# mock is removed.
|
||||||
|
await hass.config_entries.async_unload(config_entry.entry_id)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
@ -169,7 +172,7 @@ async def test_reauth(
|
|||||||
)
|
)
|
||||||
async def test_options_add_sensor(
|
async def test_options_add_sensor(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
api,
|
mock_aiopurpleair,
|
||||||
config_entry,
|
config_entry,
|
||||||
get_nearby_sensors_errors,
|
get_nearby_sensors_errors,
|
||||||
get_nearby_sensors_mock,
|
get_nearby_sensors_mock,
|
||||||
@ -187,7 +190,9 @@ async def test_options_add_sensor(
|
|||||||
assert result["step_id"] == "add_sensor"
|
assert result["step_id"] == "add_sensor"
|
||||||
|
|
||||||
# Test errors that can arise when searching for nearby sensors:
|
# Test errors that can arise when searching for nearby sensors:
|
||||||
with patch.object(api.sensors, "async_get_nearby_sensors", get_nearby_sensors_mock):
|
with patch.object(
|
||||||
|
mock_aiopurpleair.sensors, "async_get_nearby_sensors", get_nearby_sensors_mock
|
||||||
|
):
|
||||||
result = await hass.config_entries.options.async_configure(
|
result = await hass.config_entries.options.async_configure(
|
||||||
result["flow_id"],
|
result["flow_id"],
|
||||||
user_input={
|
user_input={
|
||||||
@ -225,6 +230,9 @@ async def test_options_add_sensor(
|
|||||||
TEST_SENSOR_INDEX1,
|
TEST_SENSOR_INDEX1,
|
||||||
TEST_SENSOR_INDEX2,
|
TEST_SENSOR_INDEX2,
|
||||||
]
|
]
|
||||||
|
# Unload to make sure the update does not run after the
|
||||||
|
# mock is removed.
|
||||||
|
await hass.config_entries.async_unload(config_entry.entry_id)
|
||||||
|
|
||||||
|
|
||||||
async def test_options_add_sensor_duplicate(
|
async def test_options_add_sensor_duplicate(
|
||||||
@ -260,6 +268,9 @@ async def test_options_add_sensor_duplicate(
|
|||||||
)
|
)
|
||||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||||
assert result["reason"] == "already_configured"
|
assert result["reason"] == "already_configured"
|
||||||
|
# Unload to make sure the update does not run after the
|
||||||
|
# mock is removed.
|
||||||
|
await hass.config_entries.async_unload(config_entry.entry_id)
|
||||||
|
|
||||||
|
|
||||||
async def test_options_remove_sensor(
|
async def test_options_remove_sensor(
|
||||||
@ -288,3 +299,6 @@ async def test_options_remove_sensor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
assert config_entry.options["sensor_indices"] == []
|
assert config_entry.options["sensor_indices"] == []
|
||||||
|
# Unload to make sure the update does not run after the
|
||||||
|
# mock is removed.
|
||||||
|
await hass.config_entries.async_unload(config_entry.entry_id)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user