Fix Google API key test (#31492)
This commit is contained in:
parent
0f56fc75b3
commit
472fe7a0fa
1 changed files with 9 additions and 5 deletions
|
@ -3,17 +3,21 @@ from homeassistant.components import google_assistant as ga
|
||||||
from homeassistant.core import Context
|
from homeassistant.core import Context
|
||||||
from homeassistant.setup import async_setup_component
|
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):
|
async def test_request_sync_service(aioclient_mock, hass):
|
||||||
"""Test that it posts to the request_sync url."""
|
"""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)
|
aioclient_mock.post(ga.const.REQUEST_SYNC_BASE_URL, status=200)
|
||||||
|
|
||||||
await async_setup_component(
|
await async_setup_component(
|
||||||
hass,
|
hass, "google_assistant", {"google_assistant": DUMMY_CONFIG},
|
||||||
"google_assistant",
|
|
||||||
{"google_assistant": {"project_id": "test_project", "api_key": GA_API_KEY}},
|
|
||||||
)
|
)
|
||||||
|
|
||||||
assert aioclient_mock.call_count == 0
|
assert aioclient_mock.call_count == 0
|
||||||
|
@ -24,4 +28,4 @@ async def test_request_sync_service(aioclient_mock, hass):
|
||||||
context=Context(user_id="123"),
|
context=Context(user_id="123"),
|
||||||
)
|
)
|
||||||
|
|
||||||
assert aioclient_mock.call_count == 1
|
assert aioclient_mock.call_count == 2 # token + request
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue