Hardcode Telegram market channel URL and update bot tests
This commit is contained in:
@@ -219,10 +219,7 @@ const TELEGRAM_GROUP_URL = String(
|
|||||||
const TELEGRAM_BOT_URL = String(
|
const TELEGRAM_BOT_URL = String(
|
||||||
process.env.NEXT_PUBLIC_TELEGRAM_BOT_URL || "https://t.me/WeatherQuant_bot",
|
process.env.NEXT_PUBLIC_TELEGRAM_BOT_URL || "https://t.me/WeatherQuant_bot",
|
||||||
).trim();
|
).trim();
|
||||||
const TELEGRAM_MARKET_CHANNEL_URL = String(
|
const TELEGRAM_MARKET_CHANNEL_URL = "https://t.me/+hGAk7JsjtdhiOTUx";
|
||||||
process.env.NEXT_PUBLIC_TELEGRAM_MARKET_CHANNEL_URL ||
|
|
||||||
"https://t.me/+hGAk7JsjtdhiOTUx",
|
|
||||||
).trim();
|
|
||||||
const SUBSCRIPTION_HELP_HREF = "/subscription-help";
|
const SUBSCRIPTION_HELP_HREF = "/subscription-help";
|
||||||
|
|
||||||
let walletConnectProviderCache: EvmProvider | null = null;
|
let walletConnectProviderCache: EvmProvider | null = null;
|
||||||
|
|||||||
@@ -9,11 +9,31 @@ class DummyBot:
|
|||||||
self.replies = []
|
self.replies = []
|
||||||
self.sent_messages = []
|
self.sent_messages = []
|
||||||
|
|
||||||
def reply_to(self, message, text, parse_mode=None):
|
def reply_to(self, message, text, parse_mode=None, disable_web_page_preview=None):
|
||||||
self.replies.append({"text": text, "parse_mode": parse_mode, "chat_id": message.chat.id})
|
self.replies.append(
|
||||||
|
{
|
||||||
|
"text": text,
|
||||||
|
"parse_mode": parse_mode,
|
||||||
|
"chat_id": message.chat.id,
|
||||||
|
"disable_web_page_preview": disable_web_page_preview,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
def send_message(self, chat_id, text, parse_mode=None): # pragma: no cover
|
def send_message(
|
||||||
self.sent_messages.append({"chat_id": chat_id, "text": text, "parse_mode": parse_mode})
|
self,
|
||||||
|
chat_id,
|
||||||
|
text,
|
||||||
|
parse_mode=None,
|
||||||
|
disable_web_page_preview=None,
|
||||||
|
): # pragma: no cover
|
||||||
|
self.sent_messages.append(
|
||||||
|
{
|
||||||
|
"chat_id": chat_id,
|
||||||
|
"text": text,
|
||||||
|
"parse_mode": parse_mode,
|
||||||
|
"disable_web_page_preview": disable_web_page_preview,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
def message_handler(self, *args, **kwargs): # pragma: no cover - decorator stub
|
def message_handler(self, *args, **kwargs): # pragma: no cover - decorator stub
|
||||||
def _decorator(func):
|
def _decorator(func):
|
||||||
@@ -79,6 +99,10 @@ def test_basic_handler_markets_returns_summary(monkeypatch):
|
|||||||
"src.utils.telegram_push.build_market_monitor_digest",
|
"src.utils.telegram_push.build_market_monitor_digest",
|
||||||
lambda config, slot_label="当前概览", top_n=None, force_refresh=False: "MARKET DIGEST",
|
lambda config, slot_label="当前概览", top_n=None, force_refresh=False: "MARKET DIGEST",
|
||||||
)
|
)
|
||||||
|
monkeypatch.setattr(
|
||||||
|
"src.utils.telegram_push.load_cached_market_monitor_digest",
|
||||||
|
lambda: "",
|
||||||
|
)
|
||||||
monkeypatch.setattr(
|
monkeypatch.setattr(
|
||||||
"src.bot.handlers.basic.threading.Thread",
|
"src.bot.handlers.basic.threading.Thread",
|
||||||
lambda target, name=None, daemon=None: SimpleNamespace(start=target),
|
lambda target, name=None, daemon=None: SimpleNamespace(start=target),
|
||||||
|
|||||||
Reference in New Issue
Block a user