From 1351304343c0ee59b1185b4144d1d140d27c76d8 Mon Sep 17 00:00:00 2001 From: Erik Date: Wed, 7 May 2025 14:22:47 +0200 Subject: [PATCH] Fix patching in network helper tests --- tests/helpers/test_network.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/tests/helpers/test_network.py b/tests/helpers/test_network.py index 46d84ea768d..0c7ff949547 100644 --- a/tests/helpers/test_network.py +++ b/tests/helpers/test_network.py @@ -663,13 +663,16 @@ async def test_get_request_host_no_host_header(hass: HomeAssistant) -> None: assert _get_request_host() is None -@patch("homeassistant.components.hassio.is_hassio", Mock(return_value=True)) +@patch( + "homeassistant.components.hassio.is_hassio", + return_value=True, +) @patch( "homeassistant.components.hassio.get_host_info", - Mock(return_value={"hostname": "homeassistant"}), + return_value={"hostname": "homeassistant"}, ) async def test_get_current_request_url_with_known_host( - hass: HomeAssistant, current_request + get_host_info, is_hassio, hass: HomeAssistant, current_request ) -> None: """Test getting current request URL with known hosts addresses.""" hass.config.api = Mock(use_ssl=False, port=8123, local_ip="127.0.0.1") @@ -728,13 +731,15 @@ async def test_get_current_request_url_with_known_host( @patch( "homeassistant.helpers.network.is_hassio", - Mock(return_value={"hostname": "homeassistant"}), + return_value={"hostname": "homeassistant"}, ) @patch( "homeassistant.components.hassio.get_host_info", - Mock(return_value={"hostname": "hellohost"}), + return_value={"hostname": "hellohost"}, ) -async def test_is_internal_request(hass: HomeAssistant, mock_current_request) -> None: +async def test_is_internal_request( + get_host_info, is_hassio, hass: HomeAssistant, mock_current_request +) -> None: """Test if accessing an instance on its internal URL.""" # Test with internal URL: http://example.local:8123 await async_process_ha_core_config(