forked from home-assistant/core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Catch exception in coordinator setup of IronOS integration (home-assi…
- Loading branch information
Showing
2 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
"""Test init of IronOS integration.""" | ||
|
||
from unittest.mock import AsyncMock | ||
|
||
from pynecil import CommunicationError | ||
import pytest | ||
|
||
from homeassistant.config_entries import ConfigEntryState | ||
from homeassistant.core import HomeAssistant | ||
|
||
from tests.common import MockConfigEntry | ||
|
||
|
||
@pytest.mark.usefixtures("ble_device") | ||
async def test_setup_config_entry_not_ready( | ||
hass: HomeAssistant, | ||
config_entry: MockConfigEntry, | ||
mock_pynecil: AsyncMock, | ||
) -> None: | ||
"""Test config entry not ready.""" | ||
mock_pynecil.get_device_info.side_effect = CommunicationError | ||
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 |