hass-core/tests/components/gogogate2/test_init.py
Robert Van Gorkom 11b786a4fc
Add config flow to gogogate2 component (#34709)
* Add config flow to gogogate2 component.

* Using a more stable gogogate api.

* Getting config flows working better by using different downstream library.

* Fixing options not getting default values.
Adding availability to cover entity.

* Simplifying return types of function.

* Address PR feedback.

* Making user config flow not abort.

* Using DataUpdateCoordinator.

* Addressing PR feedback.

* Using standard method for using hass.data

* Split auth fail test into separate tests.
2020-05-16 10:53:11 -05:00

28 lines
953 B
Python

"""Tests for the GogoGate2 component."""
import pytest
from homeassistant.components.gogogate2 import async_setup_entry
from homeassistant.components.gogogate2.common import GogoGateDataUpdateCoordinator
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady
from tests.async_mock import MagicMock, patch
from tests.common import MockConfigEntry
async def test_auth_fail(hass: HomeAssistant) -> None:
"""Test authorization failures."""
coordinator_mock: GogoGateDataUpdateCoordinator = MagicMock(
spec=GogoGateDataUpdateCoordinator
)
coordinator_mock.last_update_success = False
config_entry = MockConfigEntry()
config_entry.add_to_hass(hass)
with patch(
"homeassistant.components.gogogate2.get_data_update_coordinator",
return_value=coordinator_mock,
), pytest.raises(ConfigEntryNotReady):
await async_setup_entry(hass, config_entry)