Add switch to control downloads for nzbget (#40673)

* add switch to control downloads for nzbget

* work on switch

* Update test_config_flow.py

* Update test_sensor.py
This commit is contained in:
Chris Talkington 2020-09-28 20:14:49 -05:00 committed by GitHub
parent 47286fbe2a
commit bc89b63fc6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 183 additions and 20 deletions

View file

@ -132,7 +132,7 @@ async def test_user_form_single_instance_allowed(hass):
assert result["reason"] == "single_instance_allowed"
async def test_options_flow(hass):
async def test_options_flow(hass, nzbget_api):
"""Test updating options."""
entry = MockConfigEntry(
domain=DOMAIN,
@ -141,16 +141,22 @@ async def test_options_flow(hass):
)
entry.add_to_hass(hass)
with patch("homeassistant.components.nzbget.PLATFORMS", []):
await hass.config_entries.async_setup(entry.entry_id)
await hass.async_block_till_done()
assert entry.options[CONF_SCAN_INTERVAL] == 5
result = await hass.config_entries.options.async_init(entry.entry_id)
assert result["type"] == RESULT_TYPE_FORM
assert result["step_id"] == "init"
result = await hass.config_entries.options.async_configure(
result["flow_id"],
user_input={CONF_SCAN_INTERVAL: 15},
)
with _patch_async_setup(), _patch_async_setup_entry():
result = await hass.config_entries.options.async_configure(
result["flow_id"],
user_input={CONF_SCAN_INTERVAL: 15},
)
await hass.async_block_till_done()
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
assert result["data"][CONF_SCAN_INTERVAL] == 15