Fix Plex when using local tokenless authentication (#37096)

This commit is contained in:
jjlawren 2020-06-25 20:10:40 -04:00 committed by GitHub
parent f42eb0d5ca
commit fd1a8dd96c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 157 additions and 84 deletions

View file

@ -367,8 +367,8 @@ async def test_option_flow(hass):
)
with patch("plexapi.server.PlexServer", return_value=mock_plex_server), patch(
"homeassistant.components.plex.PlexWebsocket.listen"
) as mock_listen:
"plexapi.myplex.MyPlexAccount", return_value=MockPlexAccount()
), patch("homeassistant.components.plex.PlexWebsocket.listen") as mock_listen:
entry.add_to_hass(hass)
assert await hass.config_entries.async_setup(entry.entry_id)
await hass.async_block_till_done()
@ -417,8 +417,8 @@ async def test_missing_option_flow(hass):
)
with patch("plexapi.server.PlexServer", return_value=mock_plex_server), patch(
"homeassistant.components.plex.PlexWebsocket.listen"
) as mock_listen:
"plexapi.myplex.MyPlexAccount", return_value=MockPlexAccount()
), patch("homeassistant.components.plex.PlexWebsocket.listen") as mock_listen:
entry.add_to_hass(hass)
assert await hass.config_entries.async_setup(entry.entry_id)
await hass.async_block_till_done()
@ -471,8 +471,8 @@ async def test_option_flow_new_users_available(hass, caplog):
mock_plex_server = MockPlexServer(config_entry=entry)
with patch("plexapi.server.PlexServer", return_value=mock_plex_server), patch(
"homeassistant.components.plex.PlexWebsocket.listen"
):
"plexapi.myplex.MyPlexAccount", return_value=MockPlexAccount()
), patch("homeassistant.components.plex.PlexWebsocket.listen"):
entry.add_to_hass(hass)
assert await hass.config_entries.async_setup(entry.entry_id)
await hass.async_block_till_done()
@ -741,6 +741,8 @@ async def test_setup_with_limited_credentials(hass):
), patch.object(
mock_plex_server, "systemAccounts", side_effect=plexapi.exceptions.Unauthorized
) as mock_accounts, patch(
"plexapi.myplex.MyPlexAccount", return_value=MockPlexAccount()
), patch(
"homeassistant.components.plex.PlexWebsocket.listen"
) as mock_listen:
entry.add_to_hass(hass)