Move SmartThings imports to top (#24878)

* Move imports to top

* use lib constants

* Add missing three_axis mapping
This commit is contained in:
Andrew Sayre 2019-06-30 22:29:21 -04:00 committed by GitHub
parent 7d651e2b7a
commit 7db4eeaf7f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 176 additions and 191 deletions

View file

@ -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