1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00
This commit is contained in:
Paulus Schoutsen
2019-07-31 12:25:30 -07:00
parent da05dfe708
commit 4de97abc3a
2676 changed files with 163166 additions and 140084 deletions

View File

@@ -7,15 +7,12 @@ from homeassistant.components import config
async def test_delete_script(hass, hass_client):
"""Test deleting a script."""
with patch.object(config, 'SECTIONS', ['script']):
await async_setup_component(hass, 'config', {})
with patch.object(config, "SECTIONS", ["script"]):
await async_setup_component(hass, "config", {})
client = await hass_client()
orig_data = {
'one': {},
'two': {},
}
orig_data = {"one": {}, "two": {}}
def mock_read(path):
"""Mock reading data."""
@@ -27,15 +24,14 @@ async def test_delete_script(hass, hass_client):
"""Mock writing data."""
written.append(data)
with patch('homeassistant.components.config._read', mock_read), \
patch('homeassistant.components.config._write', mock_write):
resp = await client.delete('/api/config/script/config/two')
with patch("homeassistant.components.config._read", mock_read), patch(
"homeassistant.components.config._write", mock_write
):
resp = await client.delete("/api/config/script/config/two")
assert resp.status == 200
result = await resp.json()
assert result == {'result': 'ok'}
assert result == {"result": "ok"}
assert len(written) == 1
assert written[0] == {
'one': {}
}
assert written[0] == {"one": {}}