mirror of
https://github.com/home-assistant/core.git
synced 2025-04-25 17:57:55 +00:00
parent
20b5e92656
commit
12e7ea3a39
@ -50,8 +50,8 @@ DEFAULT_IMPORT_NAME = "Import from configuration.yaml"
|
||||
|
||||
CREATE_FIELDS = {
|
||||
vol.Required(CONF_DOMAIN): cv.string,
|
||||
vol.Required(CONF_CLIENT_ID): cv.string,
|
||||
vol.Required(CONF_CLIENT_SECRET): cv.string,
|
||||
vol.Required(CONF_CLIENT_ID): vol.All(cv.string, vol.Strip),
|
||||
vol.Required(CONF_CLIENT_SECRET): vol.All(cv.string, vol.Strip),
|
||||
vol.Optional(CONF_AUTH_DOMAIN): cv.string,
|
||||
vol.Optional(CONF_NAME): cv.string,
|
||||
}
|
||||
|
@ -795,3 +795,32 @@ async def test_remove_config_entry_without_app_credentials(
|
||||
"config_entry", {"config_entry_id": entries[0].entry_id}
|
||||
)
|
||||
assert "application_credential_id" not in result
|
||||
|
||||
|
||||
async def test_websocket_create_strips_whitespace(ws_client: ClientFixture):
|
||||
"""Test websocket create command with whitespace in the credentials."""
|
||||
client = await ws_client()
|
||||
result = await client.cmd_result(
|
||||
"create",
|
||||
{
|
||||
CONF_DOMAIN: TEST_DOMAIN,
|
||||
CONF_CLIENT_ID: f" {CLIENT_ID} ",
|
||||
CONF_CLIENT_SECRET: f" {CLIENT_SECRET} ",
|
||||
},
|
||||
)
|
||||
assert result == {
|
||||
CONF_DOMAIN: TEST_DOMAIN,
|
||||
CONF_CLIENT_ID: CLIENT_ID,
|
||||
CONF_CLIENT_SECRET: CLIENT_SECRET,
|
||||
"id": ID,
|
||||
}
|
||||
|
||||
result = await client.cmd_result("list")
|
||||
assert result == [
|
||||
{
|
||||
CONF_DOMAIN: TEST_DOMAIN,
|
||||
CONF_CLIENT_ID: CLIENT_ID,
|
||||
CONF_CLIENT_SECRET: CLIENT_SECRET,
|
||||
"id": ID,
|
||||
}
|
||||
]
|
||||
|
Loading…
x
Reference in New Issue
Block a user