Google Assistant request sync service (#10165)
* Initial commit for request_sync functionality * Fixes for Tox results * Fixed all tox issues and tested locally with GA * Review comments - api_key, conditional read descriptions * Add test for service
This commit is contained in:
parent
bc23799c71
commit
f6d511ac1a
5 changed files with 106 additions and 7 deletions
31
tests/components/google_assistant/test_init.py
Normal file
31
tests/components/google_assistant/test_init.py
Normal file
|
@ -0,0 +1,31 @@
|
|||
"""The tests for google-assistant init."""
|
||||
import asyncio
|
||||
|
||||
from homeassistant.setup import async_setup_component
|
||||
from homeassistant.components import google_assistant as ga
|
||||
|
||||
GA_API_KEY = "Agdgjsj399sdfkosd932ksd"
|
||||
GA_AGENT_USER_ID = "testid"
|
||||
|
||||
|
||||
@asyncio.coroutine
|
||||
def test_request_sync_service(aioclient_mock, hass):
|
||||
"""Test that it posts to the request_sync url."""
|
||||
aioclient_mock.post(
|
||||
ga.const.REQUEST_SYNC_BASE_URL, status=200)
|
||||
|
||||
yield from async_setup_component(hass, 'google_assistant', {
|
||||
'google_assistant': {
|
||||
'project_id': 'test_project',
|
||||
'client_id': 'r7328kwdsdfsdf03223409',
|
||||
'access_token': '8wdsfjsf932492342349234',
|
||||
'agent_user_id': GA_AGENT_USER_ID,
|
||||
'api_key': GA_API_KEY
|
||||
}})
|
||||
|
||||
assert aioclient_mock.call_count == 0
|
||||
yield from hass.services.async_call(ga.const.DOMAIN,
|
||||
ga.const.SERVICE_REQUEST_SYNC,
|
||||
blocking=True)
|
||||
|
||||
assert aioclient_mock.call_count == 1
|
Loading…
Add table
Add a link
Reference in a new issue