feat: mirror VK photos to image host

This commit is contained in:
nyan404 committed 2026-08-16 15:58:15 +03:00
1 parent 20b434dbcd
commit f6c2275af3
7 files changed
+98 -6

No files matched your search

+15
View File
@@ -123,6 +123,21 @@ class VkConversationTests(unittest.TestCase):
self.assertIn("подтверд", confirmation.lower())
self.assertEqual(dialog._states[107]["attachments"][0]["url"], "https://example.test/photo.jpg")
def test_photo_is_mirrored_before_history_save(self):
mirrored = []
def mirror(photo):
mirrored.append(photo["url"])
return "https://img.nyan404.ru/photo/abc.jpg"
dialog = BelkiDialog(attachment_mirror=mirror)
dialog.queue_attachments(108, [{"type": "photo", "url": "https://vk.example/photo.jpg"}])
dialog.handle(108, "/урок")
dialog.handle(108, "Белка [1]")
dialog.handle(108, "Котёнок [2]")
dialog.handle(108, "да")
self.assertEqual(mirrored, ["https://vk.example/photo.jpg"])
def test_natural_inspection_accepts_character_id_without_name(self):
inspected = inspect_bulk_text("осмотр дупло 6 1617140 без ресурсов")
self.assertEqual(inspected["fields"]["character_id"], 1617140)