Homekit test cleanup (#14416)

This commit is contained in:
cdce8p 2018-05-12 17:10:19 +02:00 committed by GitHub
parent b371bf700f
commit 990f476ac9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 32 additions and 5 deletions

View file

@ -56,7 +56,11 @@ async def test_debounce(hass):
async def test_home_accessory(hass):
"""Test HomeAccessory class."""
acc = HomeAccessory(hass, 'Home Accessory', 'homekit.accessory', 2, None)
entity_id = 'homekit.accessory'
hass.states.async_set(entity_id, None)
await hass.async_block_till_done()
acc = HomeAccessory(hass, 'Home Accessory', entity_id, 2, None)
assert acc.hass == hass
assert acc.display_name == 'Home Accessory'
assert acc.aid == 2
@ -76,7 +80,11 @@ async def test_home_accessory(hass):
hass.states.async_set('homekit.accessory', 'off')
await hass.async_block_till_done()
acc = HomeAccessory('hass', 'test_name', 'test_model.demo', 2, None)
entity_id = 'test_model.demo'
hass.states.async_set(entity_id, None)
await hass.async_block_till_done()
acc = HomeAccessory('hass', 'test_name', entity_id, 2, None)
assert acc.display_name == 'test_name'
assert acc.aid == 2
assert len(acc.services) == 1