1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Move request sync logic into GoogleConfig (#28227)

* Move request sync logic into GoogleConfig

* Return http status code for request_sync same as cloud

* agent_user_id is not optional for async_sync_entities now

* No need in checking parameter here

* Adjust some things for cloud tests

* Adjust some more stuff for cloud tests

* Drop uneccessary else

* Black required change

* Let async_schedule_google_sync take agent_user_id

* Assert return value on api call

* Test old api key method

* Update homeassistant/components/google_assistant/helpers.py

Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
This commit is contained in:
Joakim Plate
2019-11-26 22:47:13 +01:00
committed by GitHub
parent 5f1b0fb15c
commit 06231e7ac2
8 changed files with 121 additions and 86 deletions

View File

@@ -12,7 +12,12 @@ from tests.common import mock_coro, async_fire_time_changed
async def test_google_update_report_state(hass, cloud_prefs):
"""Test Google config responds to updating preference."""
config = CloudGoogleConfig(hass, GACTIONS_SCHEMA({}), cloud_prefs, None)
config = CloudGoogleConfig(
hass,
GACTIONS_SCHEMA({}),
cloud_prefs,
Mock(claims={"cognito:username": "abcdefghjkl"}),
)
with patch.object(
config, "async_sync_entities", side_effect=mock_coro
@@ -39,12 +44,17 @@ async def test_sync_entities(aioclient_mock, hass, cloud_prefs):
),
)
assert await config.async_sync_entities() == 404
assert await config.async_sync_entities("user") == 404
async def test_google_update_expose_trigger_sync(hass, cloud_prefs):
"""Test Google config responds to updating exposed entities."""
config = CloudGoogleConfig(hass, GACTIONS_SCHEMA({}), cloud_prefs, None)
config = CloudGoogleConfig(
hass,
GACTIONS_SCHEMA({}),
cloud_prefs,
Mock(claims={"cognito:username": "abcdefghjkl"}),
)
with patch.object(
config, "async_sync_entities", side_effect=mock_coro