mirror of
https://github.com/home-assistant/core.git
synced 2025-08-04 05:05:09 +02:00
Fix sending update when not logged in (#24624)
* Fix sending update when not logged in * Fix test
This commit is contained in:
@@ -116,7 +116,7 @@ class AlexaConfig(alexa_config.AbstractConfig):
|
||||
if body['reason'] in ('RefreshTokenNotFound', 'UnknownRegion'):
|
||||
raise RequireRelink
|
||||
|
||||
return alexa_errors.NoTokenAvailable
|
||||
raise alexa_errors.NoTokenAvailable
|
||||
|
||||
self._token = body['access_token']
|
||||
self._endpoint = body['event_endpoint']
|
||||
@@ -239,7 +239,7 @@ class AlexaConfig(alexa_config.AbstractConfig):
|
||||
|
||||
async def _handle_entity_registry_updated(self, event):
|
||||
"""Handle when entity registry updated."""
|
||||
if not self.enabled:
|
||||
if not self.enabled or not self._cloud.is_logged_in:
|
||||
return
|
||||
|
||||
action = event.data['action']
|
||||
|
@@ -352,9 +352,9 @@ async def test_alexa_update_expose_trigger_sync(hass, cloud_prefs):
|
||||
assert to_remove == ['light.kitchen']
|
||||
|
||||
|
||||
async def test_alexa_entity_registry_sync(hass, cloud_prefs):
|
||||
async def test_alexa_entity_registry_sync(hass, mock_cloud_login, cloud_prefs):
|
||||
"""Test Alexa config responds to entity registry."""
|
||||
client.AlexaConfig(hass, ALEXA_SCHEMA({}), cloud_prefs, None)
|
||||
client.AlexaConfig(hass, ALEXA_SCHEMA({}), cloud_prefs, hass.data['cloud'])
|
||||
|
||||
with patch_sync_helper() as (to_update, to_remove):
|
||||
hass.bus.async_fire(EVENT_ENTITY_REGISTRY_UPDATED, {
|
||||
|
Reference in New Issue
Block a user