Add Safe Mode (#30723)

* Store last working HTTP settings

* Add safe mode

* Fix tests

* Add cloud to safe mode

* Update logging text

* Fix camera tests leaving files behind

* Make emulated_hue tests not leave files behind

* Make logbook tests not leave files behind

* Make tts tests not leave files behind

* Make image_processing tests not leave files behind

* Make manual_mqtt tests not leave files behind
This commit is contained in:
Paulus Schoutsen authored and GitHub committed 2020-01-14 13:03:02 -08:00
1 parent c4673ddee1
commit 5fdc60e067
35 files changed
+480 -430

No files matched your search

+10 -13
View File
@@ -496,14 +496,13 @@ async def test_reload_config_service(hass, calls, hass_admin_user, hass_read_onl
}
},
):
with patch("homeassistant.config.find_config_file", return_value=""):
with pytest.raises(Unauthorized):
await common.async_reload(hass, Context(user_id=hass_read_only_user.id))
await hass.async_block_till_done()
await common.async_reload(hass, Context(user_id=hass_admin_user.id))
await hass.async_block_till_done()
# De-flake ?!
with pytest.raises(Unauthorized):
await common.async_reload(hass, Context(user_id=hass_read_only_user.id))
await hass.async_block_till_done()
await common.async_reload(hass, Context(user_id=hass_admin_user.id))
await hass.async_block_till_done()
# De-flake ?!
await hass.async_block_till_done()
assert hass.states.get("automation.hello") is None
assert hass.states.get("automation.bye") is not None
@@ -551,9 +550,8 @@ async def test_reload_config_when_invalid_config(hass, calls):
autospec=True,
return_value={automation.DOMAIN: "not valid"},
):
with patch("homeassistant.config.find_config_file", return_value=""):
await common.async_reload(hass)
await hass.async_block_till_done()
await common.async_reload(hass)
await hass.async_block_till_done()
assert hass.states.get("automation.hello") is None
@@ -590,9 +588,8 @@ async def test_reload_config_handles_load_fails(hass, calls):
"homeassistant.config.load_yaml_config_file",
side_effect=HomeAssistantError("bla"),
):
with patch("homeassistant.config.find_config_file", return_value=""):
await common.async_reload(hass)
await hass.async_block_till_done()
await common.async_reload(hass)
await hass.async_block_till_done()
assert hass.states.get("automation.hello") is not None