fix: ignore interactive VK chat messages
This commit is contained in:
1 parent
ae04d7cb09
commit
ed85f94e8d
2 files changed
+21
No files matched your search
@@ -13,6 +13,24 @@ from app.belki.vk_bot import (
|
||||
|
||||
|
||||
class VkBotTests(unittest.TestCase):
|
||||
def test_public_chat_messages_are_ignored_but_invite_is_registered(self):
|
||||
class Client:
|
||||
def __init__(self): self.sent = []
|
||||
def call(self, method, params): return {"title": "Тестовая беседа"}
|
||||
def send(self, *args, **kwargs): self.sent.append((args, kwargs))
|
||||
class Store:
|
||||
def __init__(self): self.items = []
|
||||
def upsert_conversation(self, **kwargs): self.items.append(kwargs)
|
||||
bot = BelkiBot.__new__(BelkiBot)
|
||||
bot.client = Client(); bot.conversation_store = Store()
|
||||
bot.application_dialog = bot.dialog = object()
|
||||
bot.handle_event({"type": "message_new", "object": {"message": {
|
||||
"peer_id": 2000000007, "from_id": 42, "text": "/help",
|
||||
"action": {"type": "chat_invite_user"},
|
||||
}}})
|
||||
self.assertEqual(bot.client.sent, [])
|
||||
self.assertEqual(bot.conversation_store.items[0]["title"], "Тестовая беседа")
|
||||
|
||||
def test_parse_coaching_command(self):
|
||||
command = parse_text_command(
|
||||
"/лу 15.08 11:00 11:20 | Дикая Вишня [1604614] | Серолап [1617140] | самостоятельно"
|
||||
|
||||
Reference in new issue
Block a user