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 InverterReturnedError in APSystems (home-assistant#131930)
Co-authored-by: epenet <[email protected]>
- Loading branch information
1 parent
e3885b8
commit 6a09474
Showing
3 changed files
with
44 additions
and
4 deletions.
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
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,25 @@ | ||
"""Test the APSystem setup.""" | ||
|
||
from unittest.mock import AsyncMock | ||
|
||
from APsystemsEZ1 import InverterReturnedError | ||
|
||
from homeassistant.components.apsystems.const import DOMAIN | ||
from homeassistant.config_entries import ConfigEntryState | ||
from homeassistant.core import HomeAssistant | ||
|
||
from . import setup_integration | ||
|
||
from tests.common import MockConfigEntry | ||
|
||
|
||
async def test_update_failed( | ||
hass: HomeAssistant, | ||
mock_apsystems: AsyncMock, | ||
mock_config_entry: MockConfigEntry, | ||
) -> None: | ||
"""Test update failed.""" | ||
mock_apsystems.get_output_data.side_effect = InverterReturnedError | ||
await setup_integration(hass, mock_config_entry) | ||
entry = hass.config_entries.async_entries(DOMAIN)[0] | ||
assert entry.state is ConfigEntryState.SETUP_RETRY |