Move SmartThings imports to top (#24878)
* Move imports to top * use lib constants * Add missing three_axis mapping
This commit is contained in:
1 parent
7d651e2b7a
commit
7db4eeaf7f
12 files changed
+176
-191
No files matched your search
@@ -5,7 +5,8 @@ from uuid import uuid4
|
||||
|
||||
from pysmartthings import (
|
||||
CLASSIFICATION_AUTOMATION, AppEntity, AppOAuthClient, AppSettings,
|
||||
DeviceEntity, InstalledApp, Location, SceneEntity, Subscription)
|
||||
DeviceEntity, InstalledApp, Location, SceneEntity, SmartThings,
|
||||
Subscription)
|
||||
from pysmartthings.api import Api
|
||||
import pytest
|
||||
|
||||
@@ -23,6 +24,8 @@ from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.common import mock_coro
|
||||
|
||||
COMPONENT_PREFIX = "homeassistant.components.smartthings."
|
||||
|
||||
|
||||
async def setup_platform(hass, platform: str, *,
|
||||
devices=None, scenes=None):
|
||||
@@ -163,8 +166,12 @@ def smartthings_mock_fixture(locations):
|
||||
return_value=next(location for location in locations
|
||||
if location.location_id == location_id))
|
||||
|
||||
with patch("pysmartthings.SmartThings", autospec=True) as mock:
|
||||
mock.return_value.location.side_effect = _location
|
||||
smartthings_mock = Mock(SmartThings)
|
||||
smartthings_mock.location.side_effect = _location
|
||||
mock = Mock(return_value=smartthings_mock)
|
||||
with patch(COMPONENT_PREFIX + "SmartThings", new=mock), \
|
||||
patch(COMPONENT_PREFIX + "config_flow.SmartThings", new=mock), \
|
||||
patch(COMPONENT_PREFIX + "smartapp.SmartThings", new=mock):
|
||||
yield mock
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user