Black
This commit is contained in:
1 parent
da05dfe708
commit
4de97abc3a
2676 files changed
+163166
-140084
No files matched your search
@@ -2,7 +2,12 @@
|
||||
from pyheos import CommandError, const
|
||||
|
||||
from homeassistant.components.heos.const import (
|
||||
ATTR_PASSWORD, ATTR_USERNAME, DOMAIN, SERVICE_SIGN_IN, SERVICE_SIGN_OUT)
|
||||
ATTR_PASSWORD,
|
||||
ATTR_USERNAME,
|
||||
DOMAIN,
|
||||
SERVICE_SIGN_IN,
|
||||
SERVICE_SIGN_OUT,
|
||||
)
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
|
||||
@@ -18,9 +23,11 @@ async def test_sign_in(hass, config_entry, controller):
|
||||
await setup_component(hass, config_entry)
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN, SERVICE_SIGN_IN,
|
||||
DOMAIN,
|
||||
SERVICE_SIGN_IN,
|
||||
{ATTR_USERNAME: "test@test.com", ATTR_PASSWORD: "password"},
|
||||
blocking=True)
|
||||
blocking=True,
|
||||
)
|
||||
|
||||
controller.sign_in.assert_called_once_with("test@test.com", "password")
|
||||
|
||||
@@ -31,9 +38,11 @@ async def test_sign_in_not_connected(hass, config_entry, controller, caplog):
|
||||
controller.connection_state = const.STATE_RECONNECTING
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN, SERVICE_SIGN_IN,
|
||||
DOMAIN,
|
||||
SERVICE_SIGN_IN,
|
||||
{ATTR_USERNAME: "test@test.com", ATTR_PASSWORD: "password"},
|
||||
blocking=True)
|
||||
blocking=True,
|
||||
)
|
||||
|
||||
assert controller.sign_in.call_count == 0
|
||||
assert "Unable to sign in because HEOS is not connected" in caplog.text
|
||||
@@ -45,9 +54,11 @@ async def test_sign_in_failed(hass, config_entry, controller, caplog):
|
||||
controller.sign_in.side_effect = CommandError("", "Invalid credentials", 6)
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN, SERVICE_SIGN_IN,
|
||||
DOMAIN,
|
||||
SERVICE_SIGN_IN,
|
||||
{ATTR_USERNAME: "test@test.com", ATTR_PASSWORD: "password"},
|
||||
blocking=True)
|
||||
blocking=True,
|
||||
)
|
||||
|
||||
controller.sign_in.assert_called_once_with("test@test.com", "password")
|
||||
assert "Sign in failed: Invalid credentials (6)" in caplog.text
|
||||
@@ -59,9 +70,11 @@ async def test_sign_in_unknown_error(hass, config_entry, controller, caplog):
|
||||
controller.sign_in.side_effect = ConnectionError
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN, SERVICE_SIGN_IN,
|
||||
DOMAIN,
|
||||
SERVICE_SIGN_IN,
|
||||
{ATTR_USERNAME: "test@test.com", ATTR_PASSWORD: "password"},
|
||||
blocking=True)
|
||||
blocking=True,
|
||||
)
|
||||
|
||||
controller.sign_in.assert_called_once_with("test@test.com", "password")
|
||||
assert "Unable to sign in" in caplog.text
|
||||
|
||||
Reference in new issue
Block a user