fix(bot): Telegram through TG_PROXY_URL — docker on the RF server has no IPv4 route to Telegram
CI / ruff · pytest (pull_request) Successful in 2m28s
CI / ruff · pytest (pull_request) Successful in 2m28s
Closes #108 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
"""TG_PROXY_URL: the bot session goes through the proxy when it is set."""
|
||||
|
||||
from app.channels import telegram
|
||||
from app.config import get_settings
|
||||
|
||||
TOKEN = "123456:" + "A" * 35
|
||||
|
||||
|
||||
def test_make_bot_without_proxy(monkeypatch):
|
||||
monkeypatch.setattr(get_settings(), "tg_proxy_url", "")
|
||||
assert telegram.make_bot(TOKEN).session.proxy is None
|
||||
|
||||
|
||||
def test_make_bot_with_proxy(monkeypatch):
|
||||
monkeypatch.setattr(get_settings(), "tg_proxy_url", "http://user:pass@127.0.0.1:8888")
|
||||
assert telegram.make_bot(TOKEN).session.proxy == "http://user:pass@127.0.0.1:8888"
|
||||
Reference in New Issue
Block a user