mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 21:06:19 +00:00
Drop use of async_mock_mqtt_component (#37011)
This commit is contained in:
@@ -7,7 +7,7 @@ from homeassistant.components.mqtt.subscription import (
|
||||
)
|
||||
from homeassistant.core import callback
|
||||
|
||||
from tests.common import async_fire_mqtt_message, async_mock_mqtt_component
|
||||
from tests.common import async_fire_mqtt_message
|
||||
|
||||
|
||||
async def test_subscribe_topics(hass, mqtt_mock, caplog):
|
||||
@@ -119,7 +119,6 @@ async def test_modify_topics(hass, mqtt_mock, caplog):
|
||||
|
||||
async def test_qos_encoding_default(hass, mqtt_mock, caplog):
|
||||
"""Test default qos and encoding."""
|
||||
mock_mqtt = await async_mock_mqtt_component(hass)
|
||||
|
||||
@callback
|
||||
def msg_callback(*args):
|
||||
@@ -132,14 +131,13 @@ async def test_qos_encoding_default(hass, mqtt_mock, caplog):
|
||||
sub_state,
|
||||
{"test_topic1": {"topic": "test-topic1", "msg_callback": msg_callback}},
|
||||
)
|
||||
mock_mqtt.async_subscribe.assert_called_once_with(
|
||||
mqtt_mock.async_subscribe.assert_called_once_with(
|
||||
"test-topic1", mock.ANY, 0, "utf-8"
|
||||
)
|
||||
|
||||
|
||||
async def test_qos_encoding_custom(hass, mqtt_mock, caplog):
|
||||
"""Test custom qos and encoding."""
|
||||
mock_mqtt = await async_mock_mqtt_component(hass)
|
||||
|
||||
@callback
|
||||
def msg_callback(*args):
|
||||
@@ -159,14 +157,13 @@ async def test_qos_encoding_custom(hass, mqtt_mock, caplog):
|
||||
}
|
||||
},
|
||||
)
|
||||
mock_mqtt.async_subscribe.assert_called_once_with(
|
||||
mqtt_mock.async_subscribe.assert_called_once_with(
|
||||
"test-topic1", mock.ANY, 1, "utf-16"
|
||||
)
|
||||
|
||||
|
||||
async def test_no_change(hass, mqtt_mock, caplog):
|
||||
"""Test subscription to topics without change."""
|
||||
mock_mqtt = await async_mock_mqtt_component(hass)
|
||||
|
||||
@callback
|
||||
def msg_callback(*args):
|
||||
@@ -179,10 +176,10 @@ async def test_no_change(hass, mqtt_mock, caplog):
|
||||
sub_state,
|
||||
{"test_topic1": {"topic": "test-topic1", "msg_callback": msg_callback}},
|
||||
)
|
||||
call_count = mock_mqtt.async_subscribe.call_count
|
||||
call_count = mqtt_mock.async_subscribe.call_count
|
||||
sub_state = await async_subscribe_topics(
|
||||
hass,
|
||||
sub_state,
|
||||
{"test_topic1": {"topic": "test-topic1", "msg_callback": msg_callback}},
|
||||
)
|
||||
assert call_count == mock_mqtt.async_subscribe.call_count
|
||||
assert call_count == mqtt_mock.async_subscribe.call_count
|
||||
|
||||
Reference in New Issue
Block a user