From 472fe7a0fa91a7a7da8d388ef0c031ac29f4d524 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Wed, 5 Feb 2020 09:50:00 -0800 Subject: [PATCH] Fix Google API key test (#31492) --- tests/components/google_assistant/test_init.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/components/google_assistant/test_init.py b/tests/components/google_assistant/test_init.py index 2773f3c3329..0df2b032b5a 100644 --- a/tests/components/google_assistant/test_init.py +++ b/tests/components/google_assistant/test_init.py @@ -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