UniFi - Improve controller tests (#27261)

* Improve controller tests and harmonize setup_unifi_integration to one
* Store listeners to dispatchers to be used during reset
This commit is contained in:
Robert Svensson 2019-10-07 21:55:35 +02:00 committed by GitHub
parent 1febb32dd9
commit 6565c17828
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 401 additions and 583 deletions

View file

@ -4,11 +4,7 @@ from unittest.mock import Mock, patch
from homeassistant.components import unifi
from homeassistant.components.unifi import config_flow
from homeassistant.setup import async_setup_component
from homeassistant.components.unifi.const import (
CONF_CONTROLLER,
CONF_SITE_ID,
CONTROLLER_ID as CONF_CONTROLLER_ID,
)
from homeassistant.components.unifi.const import CONF_CONTROLLER, CONF_SITE_ID
from homeassistant.const import (
CONF_HOST,
CONF_PASSWORD,
@ -117,8 +113,7 @@ async def test_controller_fail_setup(hass):
mock_cntrlr.return_value.async_setup.return_value = mock_coro(False)
assert await unifi.async_setup_entry(hass, entry) is False
controller_id = CONF_CONTROLLER_ID.format(host="0.0.0.0", site="default")
assert controller_id in hass.data[unifi.DOMAIN]
assert hass.data[unifi.DOMAIN] == {}
async def test_controller_no_mac(hass):