feat: add quick choices to VK dialog

This commit is contained in:
nyan404 committed 2026-08-16 15:40:38 +03:00
1 parent 94665a24ad
commit fe70303e87
2 files changed
+53

No files matched your search

+24
View File
@@ -1,4 +1,5 @@
import unittest
from datetime import datetime
from tempfile import TemporaryDirectory
from app.belki.identity import Identity, IdentityDirectory
@@ -154,6 +155,29 @@ class VkConversationTests(unittest.TestCase):
labels = [button["action"]["label"] for row in dialog.keyboard_for(503)["buttons"] for button in row]
self.assertEqual(labels[:2], ["Сам", "Несам"])
def test_quick_buttons_cover_safe_choices(self):
dialog = BelkiDialog()
dialog.handle(504, "15.08 11:00 11:20 Белка 1 Котёнок 2")
labels = [button["action"]["label"] for row in dialog.keyboard_for(504)["buttons"] for button in row]
self.assertIn("ЛУ", labels)
dialog = BelkiDialog()
dialog.handle(504, "/лу")
labels = [button["action"]["label"] for row in dialog.keyboard_for(504)["buttons"] for button in row]
self.assertIn("Сегодня", labels)
response = dialog.handle(504, "__today__")
self.assertIn("начал", response.lower())
self.assertEqual(dialog._states[504]["date"], datetime.now().strftime("%d.%m"))
inspection = BelkiDialog()
inspection.handle(505, "/осмотр")
labels = [button["action"]["label"] for row in inspection.keyboard_for(505)["buttons"] for button in row]
self.assertEqual(labels[:2], ["Дупло", "Расщелина"])
inspection.handle(505, "дупло")
inspection.handle(505, "0")
inspection.handle(505, "Серолап [2]")
labels = [button["action"]["label"] for row in inspection.keyboard_for(505)["buttons"] for button in row]
self.assertIn("Без ресурсов", labels)
if __name__ == "__main__":
unittest.main()