mirror of
https://github.com/home-assistant/core.git
synced 2025-08-03 12:45:28 +02:00
Remove constant DEFAULT_CONFIG from alexa tests (#64031)
This commit is contained in:
@@ -55,7 +55,9 @@ class MockConfig(config.AbstractConfig):
|
|||||||
"""Accept a grant."""
|
"""Accept a grant."""
|
||||||
|
|
||||||
|
|
||||||
DEFAULT_CONFIG = MockConfig(None)
|
def get_default_config():
|
||||||
|
"""Return a MockConfig instance."""
|
||||||
|
return MockConfig(None)
|
||||||
|
|
||||||
|
|
||||||
def get_new_request(namespace, name, endpoint=None):
|
def get_new_request(namespace, name, endpoint=None):
|
||||||
@@ -104,7 +106,9 @@ async def assert_request_calls_service(
|
|||||||
domain, service_name = service.split(".")
|
domain, service_name = service.split(".")
|
||||||
calls = async_mock_service(hass, domain, service_name)
|
calls = async_mock_service(hass, domain, service_name)
|
||||||
|
|
||||||
msg = await smart_home.async_handle_message(hass, DEFAULT_CONFIG, request, context)
|
msg = await smart_home.async_handle_message(
|
||||||
|
hass, get_default_config(), request, context
|
||||||
|
)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
assert len(calls) == 1
|
assert len(calls) == 1
|
||||||
@@ -128,7 +132,7 @@ async def assert_request_fails(
|
|||||||
domain, service_name = service_not_called.split(".")
|
domain, service_name = service_not_called.split(".")
|
||||||
call = async_mock_service(hass, domain, service_name)
|
call = async_mock_service(hass, domain, service_name)
|
||||||
|
|
||||||
msg = await smart_home.async_handle_message(hass, DEFAULT_CONFIG, request)
|
msg = await smart_home.async_handle_message(hass, get_default_config(), request)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
assert not call
|
assert not call
|
||||||
@@ -187,7 +191,7 @@ async def reported_properties(hass, endpoint):
|
|||||||
assertions about the properties.
|
assertions about the properties.
|
||||||
"""
|
"""
|
||||||
request = get_new_request("Alexa", "ReportState", endpoint)
|
request = get_new_request("Alexa", "ReportState", endpoint)
|
||||||
msg = await smart_home.async_handle_message(hass, DEFAULT_CONFIG, request)
|
msg = await smart_home.async_handle_message(hass, get_default_config(), request)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
return ReportedProperties(msg["context"]["properties"])
|
return ReportedProperties(msg["context"]["properties"])
|
||||||
|
|
||||||
|
@@ -29,9 +29,9 @@ from homeassistant.const import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
from . import (
|
from . import (
|
||||||
DEFAULT_CONFIG,
|
|
||||||
assert_request_calls_service,
|
assert_request_calls_service,
|
||||||
assert_request_fails,
|
assert_request_fails,
|
||||||
|
get_default_config,
|
||||||
get_new_request,
|
get_new_request,
|
||||||
reported_properties,
|
reported_properties,
|
||||||
)
|
)
|
||||||
@@ -56,7 +56,7 @@ async def test_api_adjust_brightness(hass, result, adjust):
|
|||||||
|
|
||||||
call_light = async_mock_service(hass, "light", "turn_on")
|
call_light = async_mock_service(hass, "light", "turn_on")
|
||||||
|
|
||||||
msg = await smart_home.async_handle_message(hass, DEFAULT_CONFIG, request)
|
msg = await smart_home.async_handle_message(hass, get_default_config(), request)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
assert "event" in msg
|
assert "event" in msg
|
||||||
@@ -86,7 +86,7 @@ async def test_api_set_color_rgb(hass):
|
|||||||
|
|
||||||
call_light = async_mock_service(hass, "light", "turn_on")
|
call_light = async_mock_service(hass, "light", "turn_on")
|
||||||
|
|
||||||
msg = await smart_home.async_handle_message(hass, DEFAULT_CONFIG, request)
|
msg = await smart_home.async_handle_message(hass, get_default_config(), request)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
assert "event" in msg
|
assert "event" in msg
|
||||||
@@ -112,7 +112,7 @@ async def test_api_set_color_temperature(hass):
|
|||||||
|
|
||||||
call_light = async_mock_service(hass, "light", "turn_on")
|
call_light = async_mock_service(hass, "light", "turn_on")
|
||||||
|
|
||||||
msg = await smart_home.async_handle_message(hass, DEFAULT_CONFIG, request)
|
msg = await smart_home.async_handle_message(hass, get_default_config(), request)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
assert "event" in msg
|
assert "event" in msg
|
||||||
@@ -140,7 +140,7 @@ async def test_api_decrease_color_temp(hass, result, initial):
|
|||||||
|
|
||||||
call_light = async_mock_service(hass, "light", "turn_on")
|
call_light = async_mock_service(hass, "light", "turn_on")
|
||||||
|
|
||||||
msg = await smart_home.async_handle_message(hass, DEFAULT_CONFIG, request)
|
msg = await smart_home.async_handle_message(hass, get_default_config(), request)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
assert "event" in msg
|
assert "event" in msg
|
||||||
@@ -168,7 +168,7 @@ async def test_api_increase_color_temp(hass, result, initial):
|
|||||||
|
|
||||||
call_light = async_mock_service(hass, "light", "turn_on")
|
call_light = async_mock_service(hass, "light", "turn_on")
|
||||||
|
|
||||||
msg = await smart_home.async_handle_message(hass, DEFAULT_CONFIG, request)
|
msg = await smart_home.async_handle_message(hass, get_default_config(), request)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
assert "event" in msg
|
assert "event" in msg
|
||||||
|
@@ -4,7 +4,7 @@ from unittest.mock import patch
|
|||||||
from homeassistant.components.alexa import smart_home
|
from homeassistant.components.alexa import smart_home
|
||||||
from homeassistant.const import __version__
|
from homeassistant.const import __version__
|
||||||
|
|
||||||
from . import DEFAULT_CONFIG, get_new_request
|
from . import get_default_config, get_new_request
|
||||||
|
|
||||||
|
|
||||||
async def test_unsupported_domain(hass):
|
async def test_unsupported_domain(hass):
|
||||||
@@ -13,7 +13,7 @@ async def test_unsupported_domain(hass):
|
|||||||
|
|
||||||
hass.states.async_set("woz.boop", "on", {"friendly_name": "Boop Woz"})
|
hass.states.async_set("woz.boop", "on", {"friendly_name": "Boop Woz"})
|
||||||
|
|
||||||
msg = await smart_home.async_handle_message(hass, DEFAULT_CONFIG, request)
|
msg = await smart_home.async_handle_message(hass, get_default_config(), request)
|
||||||
|
|
||||||
assert "event" in msg
|
assert "event" in msg
|
||||||
msg = msg["event"]
|
msg = msg["event"]
|
||||||
@@ -27,7 +27,7 @@ async def test_serialize_discovery(hass):
|
|||||||
|
|
||||||
hass.states.async_set("switch.bla", "on", {"friendly_name": "Boop Woz"})
|
hass.states.async_set("switch.bla", "on", {"friendly_name": "Boop Woz"})
|
||||||
|
|
||||||
msg = await smart_home.async_handle_message(hass, DEFAULT_CONFIG, request)
|
msg = await smart_home.async_handle_message(hass, get_default_config(), request)
|
||||||
|
|
||||||
assert "event" in msg
|
assert "event" in msg
|
||||||
msg = msg["event"]
|
msg = msg["event"]
|
||||||
@@ -51,7 +51,7 @@ async def test_serialize_discovery_recovers(hass, caplog):
|
|||||||
"homeassistant.components.alexa.capabilities.AlexaPowerController.serialize_discovery",
|
"homeassistant.components.alexa.capabilities.AlexaPowerController.serialize_discovery",
|
||||||
side_effect=TypeError,
|
side_effect=TypeError,
|
||||||
):
|
):
|
||||||
msg = await smart_home.async_handle_message(hass, DEFAULT_CONFIG, request)
|
msg = await smart_home.async_handle_message(hass, get_default_config(), request)
|
||||||
|
|
||||||
assert "event" in msg
|
assert "event" in msg
|
||||||
msg = msg["event"]
|
msg = msg["event"]
|
||||||
|
@@ -31,13 +31,13 @@ from homeassistant.helpers import entityfilter
|
|||||||
from homeassistant.setup import async_setup_component
|
from homeassistant.setup import async_setup_component
|
||||||
|
|
||||||
from . import (
|
from . import (
|
||||||
DEFAULT_CONFIG,
|
|
||||||
MockConfig,
|
MockConfig,
|
||||||
ReportedProperties,
|
ReportedProperties,
|
||||||
assert_power_controller_works,
|
assert_power_controller_works,
|
||||||
assert_request_calls_service,
|
assert_request_calls_service,
|
||||||
assert_request_fails,
|
assert_request_fails,
|
||||||
assert_scene_controller_works,
|
assert_scene_controller_works,
|
||||||
|
get_default_config,
|
||||||
get_new_request,
|
get_new_request,
|
||||||
reported_properties,
|
reported_properties,
|
||||||
)
|
)
|
||||||
@@ -121,7 +121,7 @@ async def test_wrong_version(hass):
|
|||||||
msg["directive"]["header"]["payloadVersion"] = "2"
|
msg["directive"]["header"]["payloadVersion"] = "2"
|
||||||
|
|
||||||
with pytest.raises(AssertionError):
|
with pytest.raises(AssertionError):
|
||||||
await smart_home.async_handle_message(hass, DEFAULT_CONFIG, msg)
|
await smart_home.async_handle_message(hass, get_default_config(), msg)
|
||||||
|
|
||||||
|
|
||||||
async def discovery_test(device, hass, expected_endpoints=1):
|
async def discovery_test(device, hass, expected_endpoints=1):
|
||||||
@@ -131,7 +131,7 @@ async def discovery_test(device, hass, expected_endpoints=1):
|
|||||||
# setup test devices
|
# setup test devices
|
||||||
hass.states.async_set(*device)
|
hass.states.async_set(*device)
|
||||||
|
|
||||||
msg = await smart_home.async_handle_message(hass, DEFAULT_CONFIG, request)
|
msg = await smart_home.async_handle_message(hass, get_default_config(), request)
|
||||||
|
|
||||||
assert "event" in msg
|
assert "event" in msg
|
||||||
msg = msg["event"]
|
msg = msg["event"]
|
||||||
@@ -2308,7 +2308,7 @@ async def test_api_entity_not_exists(hass):
|
|||||||
|
|
||||||
call_switch = async_mock_service(hass, "switch", "turn_on")
|
call_switch = async_mock_service(hass, "switch", "turn_on")
|
||||||
|
|
||||||
msg = await smart_home.async_handle_message(hass, DEFAULT_CONFIG, request)
|
msg = await smart_home.async_handle_message(hass, get_default_config(), request)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
assert "event" in msg
|
assert "event" in msg
|
||||||
@@ -2323,7 +2323,7 @@ async def test_api_entity_not_exists(hass):
|
|||||||
async def test_api_function_not_implemented(hass):
|
async def test_api_function_not_implemented(hass):
|
||||||
"""Test api call that is not implemented to us."""
|
"""Test api call that is not implemented to us."""
|
||||||
request = get_new_request("Alexa.HAHAAH", "Sweet")
|
request = get_new_request("Alexa.HAHAAH", "Sweet")
|
||||||
msg = await smart_home.async_handle_message(hass, DEFAULT_CONFIG, request)
|
msg = await smart_home.async_handle_message(hass, get_default_config(), request)
|
||||||
|
|
||||||
assert "event" in msg
|
assert "event" in msg
|
||||||
msg = msg["event"]
|
msg = msg["event"]
|
||||||
@@ -2347,7 +2347,7 @@ async def test_api_accept_grant(hass):
|
|||||||
}
|
}
|
||||||
|
|
||||||
# setup test devices
|
# setup test devices
|
||||||
msg = await smart_home.async_handle_message(hass, DEFAULT_CONFIG, request)
|
msg = await smart_home.async_handle_message(hass, get_default_config(), request)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
assert "event" in msg
|
assert "event" in msg
|
||||||
@@ -2400,7 +2400,7 @@ async def test_logging_request(hass, events):
|
|||||||
"""Test that we log requests."""
|
"""Test that we log requests."""
|
||||||
context = Context()
|
context = Context()
|
||||||
request = get_new_request("Alexa.Discovery", "Discover")
|
request = get_new_request("Alexa.Discovery", "Discover")
|
||||||
await smart_home.async_handle_message(hass, DEFAULT_CONFIG, request, context)
|
await smart_home.async_handle_message(hass, get_default_config(), request, context)
|
||||||
|
|
||||||
# To trigger event listener
|
# To trigger event listener
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
@@ -2420,7 +2420,7 @@ async def test_logging_request_with_entity(hass, events):
|
|||||||
"""Test that we log requests."""
|
"""Test that we log requests."""
|
||||||
context = Context()
|
context = Context()
|
||||||
request = get_new_request("Alexa.PowerController", "TurnOn", "switch#xy")
|
request = get_new_request("Alexa.PowerController", "TurnOn", "switch#xy")
|
||||||
await smart_home.async_handle_message(hass, DEFAULT_CONFIG, request, context)
|
await smart_home.async_handle_message(hass, get_default_config(), request, context)
|
||||||
|
|
||||||
# To trigger event listener
|
# To trigger event listener
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
@@ -2446,7 +2446,7 @@ async def test_disabled(hass):
|
|||||||
call_switch = async_mock_service(hass, "switch", "turn_on")
|
call_switch = async_mock_service(hass, "switch", "turn_on")
|
||||||
|
|
||||||
msg = await smart_home.async_handle_message(
|
msg = await smart_home.async_handle_message(
|
||||||
hass, DEFAULT_CONFIG, request, enabled=False
|
hass, get_default_config(), request, enabled=False
|
||||||
)
|
)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
@@ -2629,7 +2629,9 @@ async def test_range_unsupported_domain(hass):
|
|||||||
request["directive"]["payload"] = {"rangeValue": 1}
|
request["directive"]["payload"] = {"rangeValue": 1}
|
||||||
request["directive"]["header"]["instance"] = "switch.speed"
|
request["directive"]["header"]["instance"] = "switch.speed"
|
||||||
|
|
||||||
msg = await smart_home.async_handle_message(hass, DEFAULT_CONFIG, request, context)
|
msg = await smart_home.async_handle_message(
|
||||||
|
hass, get_default_config(), request, context
|
||||||
|
)
|
||||||
|
|
||||||
assert "event" in msg
|
assert "event" in msg
|
||||||
msg = msg["event"]
|
msg = msg["event"]
|
||||||
@@ -2648,7 +2650,9 @@ async def test_mode_unsupported_domain(hass):
|
|||||||
request["directive"]["payload"] = {"mode": "testMode"}
|
request["directive"]["payload"] = {"mode": "testMode"}
|
||||||
request["directive"]["header"]["instance"] = "switch.direction"
|
request["directive"]["header"]["instance"] = "switch.direction"
|
||||||
|
|
||||||
msg = await smart_home.async_handle_message(hass, DEFAULT_CONFIG, request, context)
|
msg = await smart_home.async_handle_message(
|
||||||
|
hass, get_default_config(), request, context
|
||||||
|
)
|
||||||
|
|
||||||
assert "event" in msg
|
assert "event" in msg
|
||||||
msg = msg["event"]
|
msg = msg["event"]
|
||||||
@@ -3388,7 +3392,9 @@ async def test_media_player_eq_bands_not_supported(hass):
|
|||||||
"Alexa.EqualizerController", "SetBands", "media_player#test_bands"
|
"Alexa.EqualizerController", "SetBands", "media_player#test_bands"
|
||||||
)
|
)
|
||||||
request["directive"]["payload"] = {"bands": [{"name": "BASS", "value": -2}]}
|
request["directive"]["payload"] = {"bands": [{"name": "BASS", "value": -2}]}
|
||||||
msg = await smart_home.async_handle_message(hass, DEFAULT_CONFIG, request, context)
|
msg = await smart_home.async_handle_message(
|
||||||
|
hass, get_default_config(), request, context
|
||||||
|
)
|
||||||
|
|
||||||
assert "event" in msg
|
assert "event" in msg
|
||||||
msg = msg["event"]
|
msg = msg["event"]
|
||||||
@@ -3403,7 +3409,9 @@ async def test_media_player_eq_bands_not_supported(hass):
|
|||||||
request["directive"]["payload"] = {
|
request["directive"]["payload"] = {
|
||||||
"bands": [{"name": "BASS", "levelDelta": 3, "levelDirection": "UP"}]
|
"bands": [{"name": "BASS", "levelDelta": 3, "levelDirection": "UP"}]
|
||||||
}
|
}
|
||||||
msg = await smart_home.async_handle_message(hass, DEFAULT_CONFIG, request, context)
|
msg = await smart_home.async_handle_message(
|
||||||
|
hass, get_default_config(), request, context
|
||||||
|
)
|
||||||
|
|
||||||
assert "event" in msg
|
assert "event" in msg
|
||||||
msg = msg["event"]
|
msg = msg["event"]
|
||||||
@@ -3418,7 +3426,9 @@ async def test_media_player_eq_bands_not_supported(hass):
|
|||||||
request["directive"]["payload"] = {
|
request["directive"]["payload"] = {
|
||||||
"bands": [{"name": "BASS", "levelDelta": 3, "levelDirection": "UP"}]
|
"bands": [{"name": "BASS", "levelDelta": 3, "levelDirection": "UP"}]
|
||||||
}
|
}
|
||||||
msg = await smart_home.async_handle_message(hass, DEFAULT_CONFIG, request, context)
|
msg = await smart_home.async_handle_message(
|
||||||
|
hass, get_default_config(), request, context
|
||||||
|
)
|
||||||
|
|
||||||
assert "event" in msg
|
assert "event" in msg
|
||||||
msg = msg["event"]
|
msg = msg["event"]
|
||||||
@@ -3918,7 +3928,7 @@ async def test_initialize_camera_stream(hass, mock_camera, mock_stream):
|
|||||||
"homeassistant.components.demo.camera.DemoCamera.stream_source",
|
"homeassistant.components.demo.camera.DemoCamera.stream_source",
|
||||||
return_value="rtsp://example.local",
|
return_value="rtsp://example.local",
|
||||||
):
|
):
|
||||||
msg = await smart_home.async_handle_message(hass, DEFAULT_CONFIG, request)
|
msg = await smart_home.async_handle_message(hass, get_default_config(), request)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
assert "event" in msg
|
assert "event" in msg
|
||||||
|
@@ -4,7 +4,7 @@ from unittest.mock import patch
|
|||||||
from homeassistant import core
|
from homeassistant import core
|
||||||
from homeassistant.components.alexa import state_report
|
from homeassistant.components.alexa import state_report
|
||||||
|
|
||||||
from . import DEFAULT_CONFIG, TEST_URL
|
from . import TEST_URL, get_default_config
|
||||||
|
|
||||||
|
|
||||||
async def test_report_state(hass, aioclient_mock):
|
async def test_report_state(hass, aioclient_mock):
|
||||||
@@ -17,7 +17,7 @@ async def test_report_state(hass, aioclient_mock):
|
|||||||
{"friendly_name": "Test Contact Sensor", "device_class": "door"},
|
{"friendly_name": "Test Contact Sensor", "device_class": "door"},
|
||||||
)
|
)
|
||||||
|
|
||||||
await state_report.async_enable_proactive_mode(hass, DEFAULT_CONFIG)
|
await state_report.async_enable_proactive_mode(hass, get_default_config())
|
||||||
|
|
||||||
hass.states.async_set(
|
hass.states.async_set(
|
||||||
"binary_sensor.test_contact",
|
"binary_sensor.test_contact",
|
||||||
@@ -58,7 +58,7 @@ async def test_report_state_instance(hass, aioclient_mock):
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
await state_report.async_enable_proactive_mode(hass, DEFAULT_CONFIG)
|
await state_report.async_enable_proactive_mode(hass, get_default_config())
|
||||||
|
|
||||||
hass.states.async_set(
|
hass.states.async_set(
|
||||||
"fan.test_fan",
|
"fan.test_fan",
|
||||||
@@ -127,7 +127,9 @@ async def test_send_add_or_update_message(hass, aioclient_mock):
|
|||||||
"binary_sensor.non_existing", # Supported, but does not exist
|
"binary_sensor.non_existing", # Supported, but does not exist
|
||||||
"zwave.bla", # Unsupported
|
"zwave.bla", # Unsupported
|
||||||
]
|
]
|
||||||
await state_report.async_send_add_or_update_message(hass, DEFAULT_CONFIG, entities)
|
await state_report.async_send_add_or_update_message(
|
||||||
|
hass, get_default_config(), entities
|
||||||
|
)
|
||||||
|
|
||||||
assert len(aioclient_mock.mock_calls) == 1
|
assert len(aioclient_mock.mock_calls) == 1
|
||||||
call = aioclient_mock.mock_calls
|
call = aioclient_mock.mock_calls
|
||||||
@@ -153,7 +155,7 @@ async def test_send_delete_message(hass, aioclient_mock):
|
|||||||
)
|
)
|
||||||
|
|
||||||
await state_report.async_send_delete_message(
|
await state_report.async_send_delete_message(
|
||||||
hass, DEFAULT_CONFIG, ["binary_sensor.test_contact", "zwave.bla"]
|
hass, get_default_config(), ["binary_sensor.test_contact", "zwave.bla"]
|
||||||
)
|
)
|
||||||
|
|
||||||
assert len(aioclient_mock.mock_calls) == 1
|
assert len(aioclient_mock.mock_calls) == 1
|
||||||
@@ -179,7 +181,7 @@ async def test_doorbell_event(hass, aioclient_mock):
|
|||||||
{"friendly_name": "Test Doorbell Sensor", "device_class": "occupancy"},
|
{"friendly_name": "Test Doorbell Sensor", "device_class": "occupancy"},
|
||||||
)
|
)
|
||||||
|
|
||||||
await state_report.async_enable_proactive_mode(hass, DEFAULT_CONFIG)
|
await state_report.async_enable_proactive_mode(hass, get_default_config())
|
||||||
|
|
||||||
hass.states.async_set(
|
hass.states.async_set(
|
||||||
"binary_sensor.test_doorbell",
|
"binary_sensor.test_doorbell",
|
||||||
@@ -219,7 +221,8 @@ async def test_doorbell_event(hass, aioclient_mock):
|
|||||||
async def test_proactive_mode_filter_states(hass, aioclient_mock):
|
async def test_proactive_mode_filter_states(hass, aioclient_mock):
|
||||||
"""Test all the cases that filter states."""
|
"""Test all the cases that filter states."""
|
||||||
aioclient_mock.post(TEST_URL, text="", status=202)
|
aioclient_mock.post(TEST_URL, text="", status=202)
|
||||||
await state_report.async_enable_proactive_mode(hass, DEFAULT_CONFIG)
|
config = get_default_config()
|
||||||
|
await state_report.async_enable_proactive_mode(hass, config)
|
||||||
|
|
||||||
# First state should report
|
# First state should report
|
||||||
hass.states.async_set(
|
hass.states.async_set(
|
||||||
@@ -270,7 +273,7 @@ async def test_proactive_mode_filter_states(hass, aioclient_mock):
|
|||||||
"off",
|
"off",
|
||||||
{"friendly_name": "Test Contact Sensor", "device_class": "door"},
|
{"friendly_name": "Test Contact Sensor", "device_class": "door"},
|
||||||
)
|
)
|
||||||
with patch.object(DEFAULT_CONFIG, "should_expose", return_value=False):
|
with patch.object(config, "should_expose", return_value=False):
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
assert len(aioclient_mock.mock_calls) == 0
|
assert len(aioclient_mock.mock_calls) == 0
|
||||||
|
Reference in New Issue
Block a user