Integrations v2.1: Virtual integrations (#80613)

This commit is contained in:
Franck Nijhof 2022-10-21 05:09:06 +02:00 committed by GitHub
parent 6c23de94e1
commit bb287dd0ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
66 changed files with 2968 additions and 2720 deletions

View file

@ -23,13 +23,7 @@ from homeassistant.helpers.json import json_loads
from homeassistant.loader import async_get_integration
from homeassistant.setup import DATA_SETUP_TIME, async_setup_component
from tests.common import (
MockEntity,
MockEntityPlatform,
MockModule,
async_mock_service,
mock_integration,
)
from tests.common import MockEntity, MockEntityPlatform, async_mock_service
STATE_KEY_SHORT_NAMES = {
"entity_id": "e",
@ -1794,45 +1788,6 @@ async def test_validate_config_invalid(websocket_client, key, config, error):
assert msg["result"] == {key: {"valid": False, "error": error}}
async def test_supported_brands(hass, websocket_client):
"""Test supported brands."""
# Custom components without supported brands that override a built-in component with
# supported brand will still be listed in HAS_SUPPORTED_BRANDS and should be ignored.
mock_integration(
hass,
MockModule("override_without_brands"),
)
mock_integration(
hass,
MockModule("test", partial_manifest={"supported_brands": {"hello": "World"}}),
)
mock_integration(
hass,
MockModule(
"abcd", partial_manifest={"supported_brands": {"something": "Something"}}
),
)
with patch(
"homeassistant.generated.supported_brands.HAS_SUPPORTED_BRANDS",
("abcd", "test", "override_without_brands"),
):
await websocket_client.send_json({"id": 7, "type": "supported_brands"})
msg = await websocket_client.receive_json()
assert msg["id"] == 7
assert msg["type"] == const.TYPE_RESULT
assert msg["success"]
assert msg["result"] == {
"abcd": {
"something": "Something",
},
"test": {
"hello": "World",
},
}
async def test_message_coalescing(hass, websocket_client, hass_admin_user):
"""Test enabling message coalescing."""
await websocket_client.send_json(