diff --git a/tests/components/zha/test_config_flow.py b/tests/components/zha/test_config_flow.py index 17665994806..8e071247872 100644 --- a/tests/components/zha/test_config_flow.py +++ b/tests/components/zha/test_config_flow.py @@ -80,6 +80,9 @@ def mock_app(): "can_rewrite_custom_eui64": False, } } + mock_app.add_listener = MagicMock() + mock_app.groups = MagicMock() + mock_app.devices = MagicMock() with patch( "zigpy.application.ControllerApplication.new", AsyncMock(return_value=mock_app) diff --git a/tests/components/zha/test_gateway.py b/tests/components/zha/test_gateway.py index c58aaedcbbc..b9fcd4b6932 100644 --- a/tests/components/zha/test_gateway.py +++ b/tests/components/zha/test_gateway.py @@ -324,12 +324,15 @@ async def test_gateway_initialize_bellows_thread( zha_gateway._config.setdefault("zigpy_config", {}).update(config_override) with patch( - "bellows.zigbee.application.ControllerApplication.new", - new=AsyncMock(), - ) as mock_new: + "bellows.zigbee.application.ControllerApplication.new" + ) as controller_app_mock: + mock = AsyncMock() + mock.add_listener = MagicMock() + mock.groups = MagicMock() + controller_app_mock.return_value = mock await zha_gateway.async_initialize() - assert mock_new.mock_calls[0].args[0]["use_thread"] is thread_state + assert controller_app_mock.mock_calls[0].args[0]["use_thread"] is thread_state @pytest.mark.parametrize(