Fix: default parent for __setitem__ (#806)

* fix: self is default parent

* chore: mv bot fixture

* chore: add update_chat test

* fix: string CHAT_PHOTO data
This commit is contained in:
Oleg A 2022-02-08 03:30:41 +03:00 committed by GitHub
parent b39672f9b6
commit 24e933bdde
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 74 additions and 28 deletions

View file

@ -19,6 +19,14 @@ CHAT = {
"type": "private",
}
CHAT_PHOTO = {
"small_file_id": "small_file_id",
"small_file_unique_id": "small_file_unique_id",
"big_file_id": "big_file_id",
"big_file_unique_id": "big_file_unique_id",
}
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()