Test fixes (#22911)
* Fix light tests [skip ci] * Fix tests/common * Fix some mqtt tests [skip ci] * Fix tests and component manifests which have only one platform * Fix more tests and manifests * Fix demo/notify tests * Rollback test for demo.geo_location
This commit is contained in:
1 parent
1a05f7b04d
commit
590eead128
20 files changed
+68
-48
No files matched your search
@@ -81,6 +81,7 @@ async def test_manual_config_set(hass, mock_try_connection,
|
||||
"""Test we ignore entry if manual config available."""
|
||||
assert await async_setup_component(
|
||||
hass, 'mqtt', {'mqtt': {'broker': 'bla'}})
|
||||
await hass.async_block_till_done()
|
||||
assert len(mock_finish_setup.mock_calls) == 1
|
||||
|
||||
mock_try_connection.return_value = True
|
||||
|
||||
@@ -28,8 +28,7 @@ def mock_MQTT():
|
||||
yield mock_MQTT
|
||||
|
||||
|
||||
@asyncio.coroutine
|
||||
def async_mock_mqtt_client(hass, config=None):
|
||||
async def async_mock_mqtt_client(hass, config=None):
|
||||
"""Mock the MQTT paho client."""
|
||||
if config is None:
|
||||
config = {mqtt.CONF_BROKER: 'mock-broker'}
|
||||
@@ -39,10 +38,11 @@ def async_mock_mqtt_client(hass, config=None):
|
||||
mock_client().subscribe.return_value = (0, 0)
|
||||
mock_client().unsubscribe.return_value = (0, 0)
|
||||
mock_client().publish.return_value = (0, 0)
|
||||
result = yield from async_setup_component(hass, mqtt.DOMAIN, {
|
||||
result = await async_setup_component(hass, mqtt.DOMAIN, {
|
||||
mqtt.DOMAIN: config
|
||||
})
|
||||
assert result
|
||||
await hass.async_block_till_done()
|
||||
return mock_client()
|
||||
|
||||
|
||||
|
||||
@@ -36,9 +36,8 @@ class TestMQTT:
|
||||
assert setup_component(self.hass, mqtt.DOMAIN, {
|
||||
mqtt.DOMAIN: {CONF_PASSWORD: password},
|
||||
})
|
||||
self.hass.block_till_done()
|
||||
assert mock_mqtt.called
|
||||
from pprint import pprint
|
||||
pprint(mock_mqtt.mock_calls)
|
||||
assert mock_mqtt.mock_calls[1][2]['username'] == 'homeassistant'
|
||||
assert mock_mqtt.mock_calls[1][2]['password'] == password
|
||||
|
||||
@@ -61,9 +60,8 @@ class TestMQTT:
|
||||
'http': {'api_password': 'http_secret'},
|
||||
mqtt.DOMAIN: {CONF_PASSWORD: password},
|
||||
})
|
||||
self.hass.block_till_done()
|
||||
assert mock_mqtt.called
|
||||
from pprint import pprint
|
||||
pprint(mock_mqtt.mock_calls)
|
||||
assert mock_mqtt.mock_calls[1][2]['username'] == 'homeassistant'
|
||||
assert mock_mqtt.mock_calls[1][2]['password'] == password
|
||||
|
||||
|
||||
Reference in new issue
Block a user