mirror of
https://github.com/elisspace/core.git
synced 2026-09-28 21:39:55 +00:00
Warn when user tries run custom config flow (#24657)
This commit is contained in:
@@ -5,7 +5,7 @@ from unittest.mock import MagicMock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
from homeassistant import config_entries, data_entry_flow
|
||||
from homeassistant import config_entries, data_entry_flow, loader
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
from homeassistant.setup import async_setup_component
|
||||
@@ -934,3 +934,17 @@ async def test_entry_reload_error(hass, manager, state):
|
||||
assert len(async_setup_entry.mock_calls) == 0
|
||||
|
||||
assert entry.state == state
|
||||
|
||||
|
||||
async def test_init_custom_integration(hass):
|
||||
"""Test initializing flow for custom integration."""
|
||||
integration = loader.Integration(hass, 'custom_components.hue', None, {
|
||||
'name': 'Hue',
|
||||
'dependencies': [],
|
||||
'requirements': [],
|
||||
'domain': 'hue',
|
||||
})
|
||||
with pytest.raises(data_entry_flow.UnknownHandler):
|
||||
with patch('homeassistant.loader.async_get_integration',
|
||||
return_value=mock_coro(integration)):
|
||||
await hass.config_entries.flow.async_init('bla')
|
||||
|
||||
@@ -152,6 +152,16 @@ def test_integration_properties(hass):
|
||||
assert integration.domain == 'hue'
|
||||
assert integration.dependencies == ['test-dep']
|
||||
assert integration.requirements == ['test-req==1.0.0']
|
||||
assert integration.is_built_in is True
|
||||
|
||||
integration = loader.Integration(
|
||||
hass, 'custom_components.hue', None, {
|
||||
'name': 'Philips Hue',
|
||||
'domain': 'hue',
|
||||
'dependencies': ['test-dep'],
|
||||
'requirements': ['test-req==1.0.0'],
|
||||
})
|
||||
assert integration.is_built_in is False
|
||||
|
||||
|
||||
async def test_integrations_only_once(hass):
|
||||
|
||||
Reference in New Issue
Block a user