Migrate plex to use async_update_entry to alter config entries (#110405)
parent
15e8d66fea
commit
5c60ff19e9
|
@ -442,7 +442,8 @@ async def test_option_flow_new_users_available(
|
|||
OPTIONS_OWNER_ONLY[Platform.MEDIA_PLAYER][CONF_MONITORED_USERS] = {
|
||||
"User 1": {"enabled": True}
|
||||
}
|
||||
entry.options = OPTIONS_OWNER_ONLY
|
||||
entry.add_to_hass(hass)
|
||||
hass.config_entries.async_update_entry(entry, options=OPTIONS_OWNER_ONLY)
|
||||
|
||||
mock_plex_server = await setup_plex_server(config_entry=entry)
|
||||
await hass.async_block_till_done()
|
||||
|
|
|
@ -76,7 +76,8 @@ async def test_setup_with_insecure_config_entry(
|
|||
"""Test setup component with config."""
|
||||
INSECURE_DATA = copy.deepcopy(DEFAULT_DATA)
|
||||
INSECURE_DATA[const.PLEX_SERVER_CONFIG][CONF_VERIFY_SSL] = False
|
||||
entry.data = INSECURE_DATA
|
||||
entry.add_to_hass(hass)
|
||||
hass.config_entries.async_update_entry(entry, data=INSECURE_DATA)
|
||||
|
||||
await setup_plex_server(config_entry=entry)
|
||||
|
||||
|
@ -268,11 +269,12 @@ async def test_setup_when_certificate_changed(
|
|||
assert old_entry.data[const.PLEX_SERVER_CONFIG][CONF_URL] == new_url
|
||||
|
||||
|
||||
async def test_tokenless_server(entry, setup_plex_server) -> None:
|
||||
async def test_tokenless_server(hass, entry, setup_plex_server) -> None:
|
||||
"""Test setup with a server with token auth disabled."""
|
||||
TOKENLESS_DATA = copy.deepcopy(DEFAULT_DATA)
|
||||
TOKENLESS_DATA[const.PLEX_SERVER_CONFIG].pop(CONF_TOKEN, None)
|
||||
entry.data = TOKENLESS_DATA
|
||||
entry.add_to_hass(hass)
|
||||
hass.config_entries.async_update_entry(entry, data=TOKENLESS_DATA)
|
||||
|
||||
await setup_plex_server(config_entry=entry)
|
||||
assert entry.state is ConfigEntryState.LOADED
|
||||
|
|
|
@ -28,7 +28,8 @@ async def test_new_users_available(
|
|||
MONITORED_USERS = {"User 1": {"enabled": True}}
|
||||
OPTIONS_WITH_USERS = copy.deepcopy(DEFAULT_OPTIONS)
|
||||
OPTIONS_WITH_USERS[Platform.MEDIA_PLAYER][CONF_MONITORED_USERS] = MONITORED_USERS
|
||||
entry.options = OPTIONS_WITH_USERS
|
||||
entry.add_to_hass(hass)
|
||||
hass.config_entries.async_update_entry(entry, options=OPTIONS_WITH_USERS)
|
||||
|
||||
mock_plex_server = await setup_plex_server(config_entry=entry)
|
||||
|
||||
|
@ -55,7 +56,8 @@ async def test_new_ignored_users_available(
|
|||
OPTIONS_WITH_USERS = copy.deepcopy(DEFAULT_OPTIONS)
|
||||
OPTIONS_WITH_USERS[Platform.MEDIA_PLAYER][CONF_MONITORED_USERS] = MONITORED_USERS
|
||||
OPTIONS_WITH_USERS[Platform.MEDIA_PLAYER][CONF_IGNORE_NEW_SHARED_USERS] = True
|
||||
entry.options = OPTIONS_WITH_USERS
|
||||
entry.add_to_hass(hass)
|
||||
hass.config_entries.async_update_entry(entry, options=OPTIONS_WITH_USERS)
|
||||
|
||||
mock_plex_server = await setup_plex_server(config_entry=entry)
|
||||
|
||||
|
@ -167,7 +169,8 @@ async def test_ignore_plex_web_client(
|
|||
"""Test option to ignore Plex Web clients."""
|
||||
OPTIONS = copy.deepcopy(DEFAULT_OPTIONS)
|
||||
OPTIONS[Platform.MEDIA_PLAYER][CONF_IGNORE_PLEX_WEB_CLIENTS] = True
|
||||
entry.options = OPTIONS
|
||||
entry.add_to_hass(hass)
|
||||
hass.config_entries.async_update_entry(entry, options=OPTIONS)
|
||||
|
||||
mock_plex_server = await setup_plex_server(
|
||||
config_entry=entry, client_type="plexweb", disable_clients=True
|
||||
|
|
Loading…
Reference in New Issue