mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
Remove ThingTalk server configuration and related websocket command from cloud integration (#144301)
This commit is contained in:
@@ -10,7 +10,7 @@ from unittest.mock import AsyncMock, MagicMock, Mock, PropertyMock, patch
|
||||
|
||||
import aiohttp
|
||||
from freezegun.api import FrozenDateTimeFactory
|
||||
from hass_nabucasa import AlreadyConnectedError, thingtalk
|
||||
from hass_nabucasa import AlreadyConnectedError
|
||||
from hass_nabucasa.auth import (
|
||||
InvalidTotpCode,
|
||||
MFARequired,
|
||||
@@ -1745,70 +1745,6 @@ async def test_enable_alexa_state_report_fail(
|
||||
assert response["error"]["code"] == "alexa_relink"
|
||||
|
||||
|
||||
async def test_thingtalk_convert(
|
||||
hass: HomeAssistant,
|
||||
hass_ws_client: WebSocketGenerator,
|
||||
setup_cloud: None,
|
||||
) -> None:
|
||||
"""Test that we can convert a query."""
|
||||
client = await hass_ws_client(hass)
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.cloud.http_api.thingtalk.async_convert",
|
||||
return_value={"hello": "world"},
|
||||
):
|
||||
await client.send_json(
|
||||
{"id": 5, "type": "cloud/thingtalk/convert", "query": "some-data"}
|
||||
)
|
||||
response = await client.receive_json()
|
||||
|
||||
assert response["success"]
|
||||
assert response["result"] == {"hello": "world"}
|
||||
|
||||
|
||||
async def test_thingtalk_convert_timeout(
|
||||
hass: HomeAssistant,
|
||||
hass_ws_client: WebSocketGenerator,
|
||||
setup_cloud: None,
|
||||
) -> None:
|
||||
"""Test that we can convert a query."""
|
||||
client = await hass_ws_client(hass)
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.cloud.http_api.thingtalk.async_convert",
|
||||
side_effect=TimeoutError,
|
||||
):
|
||||
await client.send_json(
|
||||
{"id": 5, "type": "cloud/thingtalk/convert", "query": "some-data"}
|
||||
)
|
||||
response = await client.receive_json()
|
||||
|
||||
assert not response["success"]
|
||||
assert response["error"]["code"] == "timeout"
|
||||
|
||||
|
||||
async def test_thingtalk_convert_internal(
|
||||
hass: HomeAssistant,
|
||||
hass_ws_client: WebSocketGenerator,
|
||||
setup_cloud: None,
|
||||
) -> None:
|
||||
"""Test that we can convert a query."""
|
||||
client = await hass_ws_client(hass)
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.cloud.http_api.thingtalk.async_convert",
|
||||
side_effect=thingtalk.ThingTalkConversionError("Did not understand"),
|
||||
):
|
||||
await client.send_json(
|
||||
{"id": 5, "type": "cloud/thingtalk/convert", "query": "some-data"}
|
||||
)
|
||||
response = await client.receive_json()
|
||||
|
||||
assert not response["success"]
|
||||
assert response["error"]["code"] == "unknown_error"
|
||||
assert response["error"]["message"] == "Did not understand"
|
||||
|
||||
|
||||
async def test_tts_info(
|
||||
hass: HomeAssistant,
|
||||
hass_ws_client: WebSocketGenerator,
|
||||
|
||||
Reference in New Issue
Block a user