Fix lingering tasks in plex (#89282)

* Cleanup expected_lingering_tasks in plex

* Adjust
This commit is contained in:
epenet 2023-03-08 16:53:08 +01:00 committed by GitHub
parent aff7345ea0
commit 7982f713e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -168,10 +168,11 @@ async def test_no_servers_found(
assert result["errors"]["base"] == "no_servers"
# This tests needs to be adjusted to remove lingering tasks
@pytest.mark.parametrize("expected_lingering_tasks", [True])
async def test_single_available_server(
hass: HomeAssistant, mock_plex_calls, current_request_with_host: None
hass: HomeAssistant,
mock_plex_calls,
current_request_with_host: None,
mock_setup_entry: AsyncMock,
) -> None:
"""Test creating an entry with one server available."""
result = await hass.config_entries.flow.async_init(
@ -205,17 +206,16 @@ async def test_single_available_server(
)
assert result["data"][PLEX_SERVER_CONFIG][CONF_TOKEN] == MOCK_TOKEN
await hass.config_entries.async_unload(result["result"].entry_id)
mock_setup_entry.assert_called_once()
# This tests needs to be adjusted to remove lingering tasks
@pytest.mark.parametrize("expected_lingering_tasks", [True])
async def test_multiple_servers_with_selection(
hass: HomeAssistant,
mock_plex_calls,
requests_mock: requests_mock.Mocker,
plextv_resources_two_servers,
current_request_with_host: None,
mock_setup_entry: AsyncMock,
) -> None:
"""Test creating an entry with multiple servers available."""
result = await hass.config_entries.flow.async_init(
@ -262,17 +262,16 @@ async def test_multiple_servers_with_selection(
)
assert result["data"][PLEX_SERVER_CONFIG][CONF_TOKEN] == MOCK_TOKEN
await hass.config_entries.async_unload(result["result"].entry_id)
mock_setup_entry.assert_called_once()
# This tests needs to be adjusted to remove lingering tasks
@pytest.mark.parametrize("expected_lingering_tasks", [True])
async def test_adding_last_unconfigured_server(
hass: HomeAssistant,
mock_plex_calls,
requests_mock: requests_mock.Mocker,
plextv_resources_two_servers,
current_request_with_host: None,
mock_setup_entry: AsyncMock,
) -> None:
"""Test automatically adding last unconfigured server when multiple servers on account."""
MockConfigEntry(
@ -319,7 +318,7 @@ async def test_adding_last_unconfigured_server(
)
assert result["data"][PLEX_SERVER_CONFIG][CONF_TOKEN] == MOCK_TOKEN
await hass.config_entries.async_unload(result["result"].entry_id)
assert mock_setup_entry.call_count == 2
async def test_all_available_servers_configured(