Convert some test helpers to coroutines and adjust tests (#23352)

* Convert some test helpers to coroutines

* Fix tests
This commit is contained in:
Erik Montnemery authored and Martin Hjelmare committed 2019-04-25 10:14:16 +02:00
1 parent 86b017e2f0
commit 5376e15286
24 files changed
+498 -991

No files matched your search

+4 -8
View File
@@ -86,8 +86,7 @@ async def test_sending_mqtt_commands_and_optimistic(hass, mqtt_mock):
assert state.state is STATE_UNLOCKED
assert state.attributes.get(ATTR_ASSUMED_STATE)
common.async_lock(hass, 'lock.test')
await hass.async_block_till_done()
await common.async_lock(hass, 'lock.test')
mqtt_mock.async_publish.assert_called_once_with(
'command-topic', 'LOCK', 0, False)
@@ -96,8 +95,7 @@ async def test_sending_mqtt_commands_and_optimistic(hass, mqtt_mock):
assert state.state is STATE_LOCKED
assert state.attributes.get(ATTR_ASSUMED_STATE)
common.async_unlock(hass, 'lock.test')
await hass.async_block_till_done()
await common.async_unlock(hass, 'lock.test')
mqtt_mock.async_publish.assert_called_once_with(
'command-topic', 'UNLOCK', 0, False)
@@ -125,8 +123,7 @@ async def test_sending_mqtt_commands_and_explicit_optimistic(hass, mqtt_mock):
assert state.state is STATE_UNLOCKED
assert state.attributes.get(ATTR_ASSUMED_STATE)
common.async_lock(hass, 'lock.test')
await hass.async_block_till_done()
await common.async_lock(hass, 'lock.test')
mqtt_mock.async_publish.assert_called_once_with(
'command-topic', 'LOCK', 0, False)
@@ -135,8 +132,7 @@ async def test_sending_mqtt_commands_and_explicit_optimistic(hass, mqtt_mock):
assert state.state is STATE_LOCKED
assert state.attributes.get(ATTR_ASSUMED_STATE)
common.async_unlock(hass, 'lock.test')
await hass.async_block_till_done()
await common.async_unlock(hass, 'lock.test')
mqtt_mock.async_publish.assert_called_once_with(
'command-topic', 'UNLOCK', 0, False)