Skip to content

Commit

Permalink
fix: fix test for resetting login for relogin
Browse files Browse the repository at this point in the history
closes #756
  • Loading branch information
alandtse committed May 31, 2020
1 parent 7095691 commit 2388345
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
7 changes: 3 additions & 4 deletions custom_components/alexa_media/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,14 +313,13 @@ async def async_update_data():
hide_email(email),
login_obj.status,
)
if login_obj.status and not await test_login_status(
hass, config_entry, login_obj, setup_alexa
):
login_obj.status = {}
if login_obj.status:
await login_obj.reset()
await login_obj.login()
await test_login_status(hass, config_entry, login_obj, setup_alexa)
return
except BaseException as err:
raise
raise UpdateFailed(f"Error communicating with API: {err}")

await process_notifications(login_obj, raw_notifications)
Expand Down
6 changes: 2 additions & 4 deletions custom_components/alexa_media/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,10 @@ async def wrapper(*args, **kwargs) -> Any:
"%s: Alexa API disconnected; attempting to relogin",
hide_email(email),
)
if login.status and not await test_login_status(
hass, config_entry, login, setup_alexa
):
login.status = {}
if login.status:
await login.reset()
await login.login()
await test_login_status(hass, config_entry, login, setup_alexa)
return None
return result

Expand Down

0 comments on commit 2388345

Please sign in to comment.