1
0
mirror of https://github.com/home-assistant/core.git synced 2026-04-17 15:44:52 +01:00

Prevent network access in telegram_bot tests (#165284)

This commit is contained in:
Erik Montnemery
2026-03-10 21:53:35 +01:00
committed by GitHub
parent 4ae6099d84
commit cad8f97e97

View File

@@ -1,5 +1,6 @@
"""Config flow tests for the Telegram Bot integration."""
from collections.abc import Generator
from unittest.mock import AsyncMock, patch
from telegram import User
@@ -30,6 +31,15 @@ from homeassistant.data_entry_flow import FlowResultType
from tests.common import MockConfigEntry, pytest
@pytest.fixture
def mock_setup_entry() -> Generator[AsyncMock]:
"""Override async_setup_entry."""
with patch(
"homeassistant.components.telegram_bot.async_setup_entry", return_value=True
) as mock_setup_entry:
yield mock_setup_entry
async def test_options_flow(
hass: HomeAssistant, mock_webhooks_config_entry: MockConfigEntry
) -> None:
@@ -402,6 +412,7 @@ async def test_create_entry(hass: HomeAssistant) -> None:
),
],
)
@pytest.mark.usefixtures("mock_setup_entry")
async def test_create_webhook_entry(
hass: HomeAssistant, api_endpoint: str, webhook_url: str
) -> None: