Fix Google API key test (#31492)
parent
1ee1a43fb9
commit
6a4d9d3a73
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue