Fix Google API key test (#31492)

pull/31489/head
Paulus Schoutsen 2020-02-05 09:50:00 -08:00 committed by Franck Nijhof
parent 1ee1a43fb9
commit 6a4d9d3a73
No known key found for this signature in database
GPG Key ID: D62583BA8AB11CA3
1 changed files with 9 additions and 5 deletions

View File

@ -3,17 +3,21 @@ from homeassistant.components import google_assistant as ga
from homeassistant.core import Context
from homeassistant.setup import async_setup_component
GA_API_KEY = "Agdgjsj399sdfkosd932ksd"
from .test_http import DUMMY_CONFIG
async def test_request_sync_service(aioclient_mock, hass):
"""Test that it posts to the request_sync url."""
aioclient_mock.post(
ga.const.HOMEGRAPH_TOKEN_URL,
status=200,
json={"access_token": "1234", "expires_in": 3600},
)
aioclient_mock.post(ga.const.REQUEST_SYNC_BASE_URL, status=200)
await async_setup_component(
hass,
"google_assistant",
{"google_assistant": {"project_id": "test_project", "api_key": GA_API_KEY}},
hass, "google_assistant", {"google_assistant": DUMMY_CONFIG},
)
assert aioclient_mock.call_count == 0
@ -24,4 +28,4 @@ async def test_request_sync_service(aioclient_mock, hass):
context=Context(user_id="123"),
)
assert aioclient_mock.call_count == 1
assert aioclient_mock.call_count == 2 # token + request