fix: send VK keyboard payloads as JSON
This commit is contained in:
1 parent
3d58b4fc9b
commit
94665a24ad
2 files changed
+20
-1
No files matched your search
@@ -2,6 +2,7 @@ import unittest
|
||||
import json
|
||||
|
||||
from app.belki.vk_bot import (
|
||||
BelkiDialog,
|
||||
HELP_TEXT,
|
||||
build_message_request,
|
||||
parse_text_command,
|
||||
@@ -39,6 +40,14 @@ class VkBotTests(unittest.TestCase):
|
||||
self.assertEqual(BelkiBot._button_text({"payload": "menu:lu"}), "/лу")
|
||||
self.assertEqual(BelkiBot._button_text({"payload": '{"command":"confirm:yes"}'}), "да")
|
||||
|
||||
def test_keyboard_button_payloads_are_valid_json(self):
|
||||
keyboard = BelkiDialog().keyboard_for(503)
|
||||
for row in keyboard["buttons"]:
|
||||
for button in row:
|
||||
payload = json.loads(button["action"]["payload"])
|
||||
self.assertIsInstance(payload, dict)
|
||||
self.assertIn("command", payload)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user