Fix uncaught exceptions for discovery, unify_direct, spotify,… (#33735)
* used coroutinemock to avoid exception * added spec to mock to remove exception * added the current_user return value so it doesnt throw exception * fix the mocks so properties do not need .return_value * fixed missing mock values that were causing exceptions * moved patch to asynctest so no need to define m_init * fixed black error
This commit is contained in:
6 files changed
+20
-29
No files matched your search
@@ -16,6 +16,7 @@ from homeassistant.components.unifi_direct.device_tracker import (
|
||||
CONF_PORT,
|
||||
DOMAIN,
|
||||
PLATFORM_SCHEMA,
|
||||
UnifiDeviceScanner,
|
||||
_response_to_json,
|
||||
get_scanner,
|
||||
)
|
||||
@@ -37,7 +38,7 @@ def setup_comp(hass):
|
||||
os.remove(yaml_devices)
|
||||
|
||||
|
||||
@patch(scanner_path, return_value=mock.MagicMock())
|
||||
@patch(scanner_path, return_value=mock.MagicMock(spec=UnifiDeviceScanner))
|
||||
async def test_get_scanner(unifi_mock, hass):
|
||||
"""Test creating an Unifi direct scanner with a password."""
|
||||
conf_dict = {
|
||||
|
||||
Reference in new issue
Block a user