|
|
|
|
@ -177,7 +177,7 @@ def test_telegram_init(default_conf, mocker, caplog) -> None:
|
|
|
|
|
assert log_has(message_str, caplog)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def test_telegram_startup(default_conf, mocker) -> None:
|
|
|
|
|
async def test_telegram_startup(default_conf, mocker, caplog) -> None:
|
|
|
|
|
app_mock = MagicMock()
|
|
|
|
|
app_mock.initialize = AsyncMock()
|
|
|
|
|
app_mock.start = AsyncMock()
|
|
|
|
|
@ -193,6 +193,12 @@ async def test_telegram_startup(default_conf, mocker) -> None:
|
|
|
|
|
assert app_mock.updater.start_polling.call_count == 1
|
|
|
|
|
assert sleep_mock.call_count == 1
|
|
|
|
|
|
|
|
|
|
# Test telegram Retries and Exceptions
|
|
|
|
|
app_mock.start = AsyncMock(side_effect=Exception("Test exception"))
|
|
|
|
|
await telegram._startup_telegram()
|
|
|
|
|
assert app_mock.start.call_count == 3
|
|
|
|
|
assert log_has("Telegram init failed.", caplog)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def test_telegram_cleanup(
|
|
|
|
|
default_conf,
|
|
|
|
|
|