mirror of
https://github.com/home-assistant/core.git
synced 2025-07-28 15:47:12 +00:00
Fix telegram_bot RuntimeWarning in tests (#146781)
This commit is contained in:
parent
29ce17abf4
commit
8c7ba11493
@ -1,6 +1,6 @@
|
|||||||
"""Config flow tests for the Telegram Bot integration."""
|
"""Config flow tests for the Telegram Bot integration."""
|
||||||
|
|
||||||
from unittest.mock import patch
|
from unittest.mock import AsyncMock, patch
|
||||||
|
|
||||||
from telegram import ChatFullInfo, User
|
from telegram import ChatFullInfo, User
|
||||||
from telegram.constants import AccentColor
|
from telegram.constants import AccentColor
|
||||||
@ -305,10 +305,19 @@ async def test_reauth_flow(
|
|||||||
|
|
||||||
# test: valid
|
# test: valid
|
||||||
|
|
||||||
with patch(
|
with (
|
||||||
"homeassistant.components.telegram_bot.config_flow.Bot.get_me",
|
patch(
|
||||||
return_value=User(123456, "Testbot", True),
|
"homeassistant.components.telegram_bot.config_flow.Bot.get_me",
|
||||||
|
return_value=User(123456, "Testbot", True),
|
||||||
|
),
|
||||||
|
patch(
|
||||||
|
"homeassistant.components.telegram_bot.webhooks.PushBot",
|
||||||
|
) as mock_pushbot,
|
||||||
):
|
):
|
||||||
|
mock_pushbot.return_value.start_application = AsyncMock()
|
||||||
|
mock_pushbot.return_value.register_webhook = AsyncMock()
|
||||||
|
mock_pushbot.return_value.shutdown = AsyncMock()
|
||||||
|
|
||||||
result = await hass.config_entries.flow.async_configure(
|
result = await hass.config_entries.flow.async_configure(
|
||||||
result["flow_id"],
|
result["flow_id"],
|
||||||
{CONF_API_KEY: "new mock api key"},
|
{CONF_API_KEY: "new mock api key"},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user