Handle software version being None when setting up HomeKit accessories (#54130)
* Convert all HomeKit service info to string prior to checking for max length * Added check for None software version * Added test case for numeric version number * Update tests/components/homekit/test_accessories.py Co-authored-by: J. Nick Koston <nick@koston.org> * Fix style & none version test * Fix test * revert other change since it should be covered by the format_sw_version fix Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
parent
d842fc288f
commit
483a4535c8
2 changed files with 35 additions and 1 deletions
|
@ -133,6 +133,39 @@ async def test_home_accessory(hass, hk_driver):
|
|||
)
|
||||
assert serv.get_characteristic(CHAR_FIRMWARE_REVISION).value == "0.4.3"
|
||||
|
||||
acc4 = HomeAccessory(
|
||||
hass,
|
||||
hk_driver,
|
||||
"Home Accessory that exceeds the maximum maximum maximum maximum maximum maximum length",
|
||||
entity_id2,
|
||||
3,
|
||||
{
|
||||
ATTR_MODEL: "Awesome Model that exceeds the maximum maximum maximum maximum maximum maximum length",
|
||||
ATTR_MANUFACTURER: "Lux Brands that exceeds the maximum maximum maximum maximum maximum maximum length",
|
||||
ATTR_SW_VERSION: "will_not_match_regex",
|
||||
ATTR_INTEGRATION: "luxe that exceeds the maximum maximum maximum maximum maximum maximum length",
|
||||
},
|
||||
)
|
||||
assert acc4.available is False
|
||||
serv = acc4.services[0] # SERV_ACCESSORY_INFO
|
||||
assert (
|
||||
serv.get_characteristic(CHAR_NAME).value
|
||||
== "Home Accessory that exceeds the maximum maximum maximum maximum "
|
||||
)
|
||||
assert (
|
||||
serv.get_characteristic(CHAR_MANUFACTURER).value
|
||||
== "Lux Brands that exceeds the maximum maximum maximum maximum maxi"
|
||||
)
|
||||
assert (
|
||||
serv.get_characteristic(CHAR_MODEL).value
|
||||
== "Awesome Model that exceeds the maximum maximum maximum maximum m"
|
||||
)
|
||||
assert (
|
||||
serv.get_characteristic(CHAR_SERIAL_NUMBER).value
|
||||
== "light.accessory_that_exceeds_the_maximum_maximum_maximum_maximum"
|
||||
)
|
||||
assert serv.get_characteristic(CHAR_FIRMWARE_REVISION).value == hass_version
|
||||
|
||||
hass.states.async_set(entity_id, "on")
|
||||
await hass.async_block_till_done()
|
||||
with patch(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue