chore: add update_chat test

This commit is contained in:
Oleg A 2022-01-10 11:30:02 +03:00
parent c7bb528cd9
commit 1c898ae317
2 changed files with 56 additions and 2 deletions

View file

@ -19,6 +19,14 @@ CHAT = {
"type": "private",
}
CHAT_PHOTO = {
"small_file_id": 1,
"small_file_unique_id": 1,
"big_file_id": 1,
"big_file_unique_id": 1,
}
PHOTO = {
"file_id": "AgADBAADFak0G88YZAf8OAug7bHyS9x2ZxkABHVfpJywcloRAAGAAQABAg",
"file_size": 1101,
@ -485,3 +493,37 @@ REPLY_KEYBOARD_MARKUP = {
"keyboard": [[{"text": "something here"}]],
"resize_keyboard": True,
}
CHAT_PERMISSIONS = {
"can_send_messages": True,
"can_send_media_messages": True,
"can_send_polls": True,
"can_send_other_messages": True,
"can_add_web_page_previews": True,
"can_change_info": True,
"can_invite_users": True,
"can_pin_messages": True,
}
CHAT_LOCATION = {
"location": LOCATION,
"address": "address",
}
FULL_CHAT = {
**CHAT,
"photo": CHAT_PHOTO,
"bio": "bio",
"has_private_forwards": False,
"description": "description",
"invite_link": "invite_link",
"pinned_message": MESSAGE,
"permissions": CHAT_PERMISSIONS,
"slow_mode_delay": 10,
"message_auto_delete_time": 60,
"has_protected_content": True,
"sticker_set_name": "sticker_set_name",
"can_set_sticker_set": True,
"linked_chat_id": -1234567890,
"location": CHAT_LOCATION,
}

View file

@ -1,5 +1,10 @@
from aiogram import types
from .dataset import CHAT
import pytest
from aiogram import Bot, types
from .dataset import CHAT, FULL_CHAT
from .. import FakeTelegram
pytestmark = pytest.mark.asyncio
chat = types.Chat(**CHAT)
@ -59,3 +64,10 @@ def test_chat_actions():
assert types.ChatActions.FIND_LOCATION == 'find_location'
assert types.ChatActions.RECORD_VIDEO_NOTE == 'record_video_note'
assert types.ChatActions.UPLOAD_VIDEO_NOTE == 'upload_video_note'
async def test_update_chat(bot: Bot):
Bot.set_current(bot)
async with FakeTelegram(message_data=FULL_CHAT):
await chat.update_chat()
assert chat.to_python() == types.Chat(**FULL_CHAT).to_python()