Google Assistant Local SDK (#27428)

* Local Google

* Fix test

* Fix tests
This commit is contained in:
Paulus Schoutsen authored and GitHub committed 2019-10-13 14:16:27 -07:00
1 parent 3454b6fa87
commit e866d769e8
17 files changed
+512 -52

No files matched your search

+1 -1
View File
@@ -25,4 +25,4 @@ def mock_cloud_prefs(hass, prefs={}):
}
prefs_to_set.update(prefs)
hass.data[cloud.DOMAIN].client._prefs._prefs = prefs_to_set
return prefs_to_set
return hass.data[cloud.DOMAIN].client._prefs
+2 -2
View File
@@ -61,7 +61,7 @@ async def test_handler_alexa(hass):
async def test_handler_alexa_disabled(hass, mock_cloud_fixture):
"""Test handler Alexa when user has disabled it."""
mock_cloud_fixture[PREF_ENABLE_ALEXA] = False
mock_cloud_fixture._prefs[PREF_ENABLE_ALEXA] = False
cloud = hass.data["cloud"]
resp = await cloud.client.async_alexa_message(
@@ -125,7 +125,7 @@ async def test_handler_google_actions(hass):
async def test_handler_google_actions_disabled(hass, mock_cloud_fixture):
"""Test handler Google Actions when user has disabled it."""
mock_cloud_fixture[PREF_ENABLE_GOOGLE] = False
mock_cloud_fixture._prefs[PREF_ENABLE_GOOGLE] = False
with patch("hass_nabucasa.Cloud.start", return_value=mock_coro()):
assert await async_setup_component(hass, "cloud", {})
+7 -13
View File
@@ -10,13 +10,7 @@ from hass_nabucasa.const import STATE_CONNECTED
from homeassistant.core import State
from homeassistant.auth.providers import trusted_networks as tn_auth
from homeassistant.components.cloud.const import (
PREF_ENABLE_GOOGLE,
PREF_ENABLE_ALEXA,
PREF_GOOGLE_SECURE_DEVICES_PIN,
DOMAIN,
RequireRelink,
)
from homeassistant.components.cloud.const import DOMAIN, RequireRelink
from homeassistant.components.google_assistant.helpers import GoogleEntity
from homeassistant.components.alexa.entities import LightCapabilities
from homeassistant.components.alexa import errors as alexa_errors
@@ -474,9 +468,9 @@ async def test_websocket_update_preferences(
hass, hass_ws_client, aioclient_mock, setup_api, mock_cloud_login
):
"""Test updating preference."""
assert setup_api[PREF_ENABLE_GOOGLE]
assert setup_api[PREF_ENABLE_ALEXA]
assert setup_api[PREF_GOOGLE_SECURE_DEVICES_PIN] is None
assert setup_api.google_enabled
assert setup_api.alexa_enabled
assert setup_api.google_secure_devices_pin is None
client = await hass_ws_client(hass)
await client.send_json(
{
@@ -490,9 +484,9 @@ async def test_websocket_update_preferences(
response = await client.receive_json()
assert response["success"]
assert not setup_api[PREF_ENABLE_GOOGLE]
assert not setup_api[PREF_ENABLE_ALEXA]
assert setup_api[PREF_GOOGLE_SECURE_DEVICES_PIN] == "1234"
assert not setup_api.google_enabled
assert not setup_api.alexa_enabled
assert setup_api.google_secure_devices_pin == "1234"
async def test_websocket_update_preferences_require_relink(