feat: show VK photos in calculation admin

This commit is contained in:
nyan404 committed 2026-08-16 15:56:17 +03:00
1 parent 6bbd8d4b0b
commit 20b434dbcd
6 files changed
+84 -5

No files matched your search

+10
View File
@@ -7,6 +7,7 @@ from app.belki.vk_bot import (
build_message_request,
parse_text_command,
BelkiBot,
extract_photo_attachments,
)
@@ -48,6 +49,15 @@ class VkBotTests(unittest.TestCase):
self.assertIsInstance(payload, dict)
self.assertIn("command", payload)
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",
"sizes": [{"width": 100, "height": 100, "url": "small"},
{"width": 1000, "height": 800, "url": "large"}],
}}]})
self.assertEqual(photos[0]["url"], "large")
self.assertEqual(photos[0]["attachment"], "photo-10_42_secret")
if __name__ == "__main__":
unittest.main()