Fix google sync (#30524)
This commit is contained in:
1 parent
a84741392b
commit
05374d7c85
7 files changed
+39
-7
No files matched your search
@@ -103,13 +103,17 @@ async def test_handler_google_actions(hass):
|
||||
reqid = "5711642932632160983"
|
||||
data = {"requestId": reqid, "inputs": [{"intent": "action.devices.SYNC"}]}
|
||||
|
||||
config = await cloud.client.get_google_config()
|
||||
resp = await cloud.client.async_google_message(data)
|
||||
with patch(
|
||||
"hass_nabucasa.Cloud._decode_claims",
|
||||
return_value={"cognito:username": "myUserName"},
|
||||
):
|
||||
await cloud.client.get_google_config()
|
||||
resp = await cloud.client.async_google_message(data)
|
||||
|
||||
assert resp["requestId"] == reqid
|
||||
payload = resp["payload"]
|
||||
|
||||
assert payload["agentUserId"] == config.cloud_user
|
||||
assert payload["agentUserId"] == "myUserName"
|
||||
|
||||
devices = payload["devices"]
|
||||
assert len(devices) == 1
|
||||
|
||||
@@ -64,6 +64,10 @@ class MockConfig(helpers.AbstractConfig):
|
||||
"""Return local SDK webhook id."""
|
||||
return self._local_sdk_user_id
|
||||
|
||||
def get_agent_user_id(self, context):
|
||||
"""Get agent user ID making request."""
|
||||
return context.user_id
|
||||
|
||||
def should_expose(self, state):
|
||||
"""Expose it all."""
|
||||
return self._should_expose is None or self._should_expose(state)
|
||||
|
||||
Reference in new issue
Block a user