Import websocket_api (part 3) (#63907)
This commit is contained in:
parent
3b7448bb1c
commit
6eb0447566
8 changed files with 32 additions and 18 deletions
|
@ -4,7 +4,11 @@ from unittest.mock import Mock, patch
|
|||
from aiohttp import WSMsgType
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.websocket_api import const, messages
|
||||
from homeassistant.components.websocket_api import (
|
||||
async_register_command,
|
||||
const,
|
||||
messages,
|
||||
)
|
||||
|
||||
|
||||
async def test_invalid_message_format(websocket_client):
|
||||
|
@ -49,7 +53,8 @@ async def test_unknown_command(websocket_client):
|
|||
|
||||
async def test_handler_failing(hass, websocket_client):
|
||||
"""Test a command that raises."""
|
||||
hass.components.websocket_api.async_register_command(
|
||||
async_register_command(
|
||||
hass,
|
||||
"bla",
|
||||
Mock(side_effect=TypeError),
|
||||
messages.BASE_COMMAND_MESSAGE_SCHEMA.extend({"type": "bla"}),
|
||||
|
@ -65,7 +70,8 @@ async def test_handler_failing(hass, websocket_client):
|
|||
|
||||
async def test_invalid_vol(hass, websocket_client):
|
||||
"""Test a command that raises invalid vol error."""
|
||||
hass.components.websocket_api.async_register_command(
|
||||
async_register_command(
|
||||
hass,
|
||||
"bla",
|
||||
Mock(side_effect=TypeError),
|
||||
messages.BASE_COMMAND_MESSAGE_SCHEMA.extend(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue