increase test coverage
This commit is contained in:
@@ -190,10 +190,6 @@ async def test_mqtt_except_no_config(config_no_conn, monkeypatch, caplog):
|
||||
|
||||
assert asyncio.get_running_loop()
|
||||
|
||||
on_connect = asyncio.Event()
|
||||
async def cb():
|
||||
on_connect.set()
|
||||
|
||||
async def my_aenter(self):
|
||||
raise MqttError('TestException') from None
|
||||
|
||||
@@ -204,10 +200,9 @@ async def test_mqtt_except_no_config(config_no_conn, monkeypatch, caplog):
|
||||
LOGGER.setLevel(logging.INFO)
|
||||
|
||||
with caplog.at_level(logging.INFO):
|
||||
m = Mqtt(cb)
|
||||
m = Mqtt(None)
|
||||
assert m.task
|
||||
await asyncio.sleep(0)
|
||||
assert not on_connect.is_set()
|
||||
try:
|
||||
await m.publish('homeassistant/status', 'online')
|
||||
assert False
|
||||
@@ -225,10 +220,6 @@ async def test_mqtt_except_def_config(config_def_conn, monkeypatch, caplog):
|
||||
|
||||
assert asyncio.get_running_loop()
|
||||
|
||||
on_connect = asyncio.Event()
|
||||
async def cb():
|
||||
on_connect.set()
|
||||
|
||||
async def my_aenter(self):
|
||||
raise MqttError('TestException') from None
|
||||
|
||||
@@ -239,10 +230,9 @@ async def test_mqtt_except_def_config(config_def_conn, monkeypatch, caplog):
|
||||
LOGGER.setLevel(logging.INFO)
|
||||
|
||||
with caplog.at_level(logging.INFO):
|
||||
m = Mqtt(cb)
|
||||
m = Mqtt(None)
|
||||
assert m.task
|
||||
await asyncio.sleep(0)
|
||||
assert not on_connect.is_set()
|
||||
try:
|
||||
await m.publish('homeassistant/status', 'online')
|
||||
assert False
|
||||
|
||||
Reference in New Issue
Block a user