Fix unhandled exceptions for config, default_config, harmony (#33731)
* replaced MagicMock with CoroutineMock to avoid exception * added conversion to str so mock returns unique-id that doesn't throw json exception * added non-empty config since hass throws exception when config is empty
This commit is contained in:
1 parent
d92d74a14f
commit
4901fa24ec
4 files changed
+6
-6
No files matched your search
@@ -1,6 +1,8 @@
|
||||
"""Test Group config panel."""
|
||||
import json
|
||||
from unittest.mock import MagicMock, patch
|
||||
from unittest.mock import patch
|
||||
|
||||
from asynctest import CoroutineMock
|
||||
|
||||
from homeassistant.bootstrap import async_setup_component
|
||||
from homeassistant.components import config
|
||||
@@ -50,7 +52,7 @@ async def test_update_device_config(hass, hass_client):
|
||||
"""Mock writing data."""
|
||||
written.append(data)
|
||||
|
||||
mock_call = MagicMock()
|
||||
mock_call = CoroutineMock()
|
||||
|
||||
with patch("homeassistant.components.config._read", mock_read), patch(
|
||||
"homeassistant.components.config._write", mock_write
|
||||
|
||||
@@ -34,4 +34,4 @@ def recorder_url_mock():
|
||||
|
||||
async def test_setup(hass):
|
||||
"""Test setup."""
|
||||
assert await async_setup_component(hass, "default_config", {})
|
||||
assert await async_setup_component(hass, "default_config", {"foo": "bar"})
|
||||
Reference in new issue
Block a user