feat: add clickable points activity menu

This commit is contained in:
nyan404 committed 2026-10-10 22:01:05 +03:00
1 parent b21ceda9df
commit 67d505f4f2
4 files changed
+33 -3

No files matched your search

+19
View File
@@ -144,11 +144,30 @@ class VkBotTests(unittest.TestCase):
def test_button_payload_maps_to_command(self):
self.assertEqual(BelkiBot._button_text({"payload": "menu:lu"}), "/лу")
self.assertEqual(BelkiBot._button_text({"payload": '{"command":"points:coaching"}'}), "прокачка")
self.assertEqual(BelkiBot._button_text({"payload": '{"command":"points:training"}'}), "тренировка")
self.assertEqual(BelkiBot._button_text({"payload": '{"command":"points:inspection"}'}), "осмотр")
self.assertEqual(BelkiBot._button_text({"payload": '{"command":"confirm:yes"}'}), "да")
self.assertEqual(BelkiBot._button_text({"payload": '{"command":"quick:inscription"}'}), "+1 надпись")
self.assertEqual(BelkiBot._button_text({"payload": '{"command":"application:flying"}'}), "/летяга")
self.assertEqual(BelkiBot._button_text({"payload": '{"command":"application:practice-no"}'}), "нет")
def test_points_choice_has_clickable_activity_menu_and_accepts_cases(self):
dialog = BelkiDialog()
dialog.handle(901, "/цель")
keyboard = dialog.keyboard_for(901)
payloads = [
json.loads(button["action"]["payload"])["command"]
for row in keyboard["buttons"] for button in row
]
self.assertEqual(payloads[:3], ["points:coaching", "points:training", "points:inspection"])
for activity in ("прокачка", "прокачку", "тренировка", "тренировку"):
current = BelkiDialog()
current.handle(902, "/цель")
response = current.handle(902, activity)
self.assertNotIn("Выберите: прокачка, тренировка или осмотр.", response)
def test_keyboard_button_payloads_are_valid_json(self):
keyboard = BelkiDialog().keyboard_for(503)
for row in keyboard["buttons"]: