1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 04:50:05 +00:00

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:
Ziv
2020-04-07 19:34:13 +03:00
committed by GitHub
parent 60bc517d01
commit bee742994e
6 changed files with 20 additions and 29 deletions

View File

@@ -157,8 +157,8 @@ async def test_scenes_unauthorized_loads_platforms(
request_info=request_info, history=None, status=403
)
mock_token = Mock()
mock_token.access_token.return_value = str(uuid4())
mock_token.refresh_token.return_value = str(uuid4())
mock_token.access_token = str(uuid4())
mock_token.refresh_token = str(uuid4())
smartthings_mock.generate_tokens.return_value = mock_token
subscriptions = [
subscription_factory(capability) for capability in device.capabilities
@@ -189,8 +189,8 @@ async def test_config_entry_loads_platforms(
smartthings_mock.devices.return_value = [device]
smartthings_mock.scenes.return_value = [scene]
mock_token = Mock()
mock_token.access_token.return_value = str(uuid4())
mock_token.refresh_token.return_value = str(uuid4())
mock_token.access_token = str(uuid4())
mock_token.refresh_token = str(uuid4())
smartthings_mock.generate_tokens.return_value = mock_token
subscriptions = [
subscription_factory(capability) for capability in device.capabilities
@@ -223,8 +223,8 @@ async def test_config_entry_loads_unconnected_cloud(
smartthings_mock.devices.return_value = [device]
smartthings_mock.scenes.return_value = [scene]
mock_token = Mock()
mock_token.access_token.return_value = str(uuid4())
mock_token.refresh_token.return_value = str(uuid4())
mock_token.access_token = str(uuid4())
mock_token.refresh_token = str(uuid4())
smartthings_mock.generate_tokens.return_value = mock_token
subscriptions = [
subscription_factory(capability) for capability in device.capabilities