Fix SwitchBot Lock test (#84682)

pull/84683/head
Damian Sypniewski 2022-12-28 14:12:52 +09:00 committed by GitHub
parent 599569bc53
commit 64cf4b2258
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 23 additions and 0 deletions

View File

@ -391,6 +391,29 @@ async def test_user_setup_wolock_or_bot(hass):
assert result["step_id"] == "lock_key"
assert result["errors"] == {}
with patch_async_setup_entry() as mock_setup_entry, patch(
"switchbot.SwitchbotLock.verify_encryption_key", return_value=True
):
result = await hass.config_entries.flow.async_configure(
result["flow_id"],
{
CONF_KEY_ID: "ff",
CONF_ENCRYPTION_KEY: "ffffffffffffffffffffffffffffffff",
},
)
await hass.async_block_till_done()
assert result["type"] == FlowResultType.CREATE_ENTRY
assert result["title"] == "Lock EEFF"
assert result["data"] == {
CONF_ADDRESS: "aa:bb:cc:dd:ee:ff",
CONF_KEY_ID: "ff",
CONF_ENCRYPTION_KEY: "ffffffffffffffffffffffffffffffff",
CONF_SENSOR_TYPE: "lock",
}
assert len(mock_setup_entry.mock_calls) == 1
async def test_user_setup_wolock_invalid_encryption_key(hass):
"""Test the user initiated form for a lock with invalid encryption key."""