Clean up Google Config (#24663)

* Clean up Google Config

* Lint

* pylint

* pylint2
This commit is contained in:
Paulus Schoutsen authored and Pascal Vizeli committed 2019-06-21 11:17:21 +02:00
1 parent d468d0f71b
commit 78b7ed0ebe
12 files changed
+460 -387

No files matched your search

+9 -11
View File
@@ -1,24 +1,22 @@
"""Tests for the cloud component."""
from unittest.mock import patch
from homeassistant.setup import async_setup_component
from homeassistant.components import cloud
from homeassistant.components.cloud import const
from jose import jwt
from tests.common import mock_coro
def mock_cloud(hass, config={}):
async def mock_cloud(hass, config=None):
"""Mock cloud."""
with patch('hass_nabucasa.Cloud.start', return_value=mock_coro()):
assert hass.loop.run_until_complete(async_setup_component(
hass, cloud.DOMAIN, {
'cloud': config
}))
hass.data[cloud.DOMAIN]._decode_claims = \
lambda token: jwt.get_unverified_claims(token)
assert await async_setup_component(
hass, cloud.DOMAIN, {
'cloud': config or {}
})
cloud_inst = hass.data['cloud']
with patch('hass_nabucasa.Cloud.run_executor', return_value=mock_coro()):
await cloud_inst.start()
def mock_cloud_prefs(hass, prefs={}):