mirror of
https://github.com/home-assistant/core.git
synced 2026-11-06 13:41:27 -04:00
Refactor coordinator data update and exception handling in Xbox integration (#154848)
This commit is contained in:
@@ -64,3 +64,33 @@ async def test_config_implementation_not_available(
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert config_entry.state is ConfigEntryState.SETUP_RETRY
|
||||
|
||||
|
||||
@pytest.mark.parametrize("exception", [ConnectTimeout, HTTPStatusError, ProtocolError])
|
||||
@pytest.mark.parametrize(
|
||||
("provider", "method"),
|
||||
[
|
||||
("smartglass", "get_console_status"),
|
||||
("catalog", "get_product_from_alternate_id"),
|
||||
("people", "get_friends_own_batch"),
|
||||
("people", "get_friends_own"),
|
||||
],
|
||||
)
|
||||
async def test_coordinator_update_failed(
|
||||
hass: HomeAssistant,
|
||||
config_entry: MockConfigEntry,
|
||||
xbox_live_client: AsyncMock,
|
||||
exception: Exception,
|
||||
provider: str,
|
||||
method: str,
|
||||
) -> None:
|
||||
"""Test coordinator update failed."""
|
||||
|
||||
provider = getattr(xbox_live_client, provider)
|
||||
getattr(provider, method).side_effect = exception
|
||||
|
||||
config_entry.add_to_hass(hass)
|
||||
await hass.config_entries.async_setup(config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert config_entry.state is ConfigEntryState.SETUP_RETRY
|
||||
|
||||
Reference in New Issue
Block a user