feat: add sent report history lookup

This commit is contained in:
nyan404 committed 2026-10-18 18:56:23 +03:00
1 parent 546fa37fce
commit 3ebab303a5
12 files changed
+393 -18

No files matched your search

+23
View File
@@ -144,6 +144,7 @@ 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":"menu:my_reports"}'}), "/мои-отчёты")
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"}'}), "осмотр")
@@ -176,6 +177,28 @@ class VkBotTests(unittest.TestCase):
self.assertIsInstance(payload, dict)
self.assertIn("command", payload)
def test_my_reports_menu_shows_only_current_vk_sender_history(self):
class Store:
def list_vk_reports(self, actor_id, *, limit=100):
self.actor_id = actor_id
return [{"id": 7, "mode": "training", "message": "Малыш [123] — тренировка.", "created_at": "2026-10-18T12:00:00+00:00"}]
store = Store()
dialog = BelkiDialog(calculation_store=store)
response = dialog.handle(900, "/мои-отчёты", user_id=501)
self.assertEqual(store.actor_id, 501)
self.assertIn("Малыш [123]", response)
self.assertIn("№7", response)
def test_my_reports_button_is_in_main_menu(self):
keyboard = BelkiDialog().keyboard_for(503)
commands = [
json.loads(button["action"]["payload"])["command"]
for row in keyboard["buttons"] for button in row
]
self.assertIn("menu:my_reports", commands)
def test_extract_photo_attachment_keeps_largest_size_and_vk_reference(self):
photos = extract_photo_attachments({"attachments": [{"type": "photo", "photo": {
"owner_id": -10, "id": 42, "access_key": "secret",