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 authored and GitHub committed 2020-04-07 09:34:13 -07:00
1 parent 60bc517d01
commit bee742994e
6 files changed
+20 -29

No files matched your search

+2 -1
View File
@@ -86,7 +86,8 @@ async def test_full_flow(hass, aiohttp_client, aioclient_mock):
},
)
with patch("homeassistant.components.spotify.config_flow.Spotify"):
with patch("homeassistant.components.spotify.config_flow.Spotify") as spotify_mock:
spotify_mock.return_value.current_user.return_value = {"id": "fake_id"}
result = await hass.config_entries.flow.async_configure(result["flow_id"])
assert result["data"]["auth_implementation"] == DOMAIN