async def test_get_chat_member(bot: Bot, event_loop): """ getChatMember method test """ from .types.dataset import CHAT, CHAT_MEMBER chat = types.Chat(**CHAT) member = types.ChatMember(**CHAT_MEMBER) async with FakeTelegram(message_data=CHAT_MEMBER, loop=event_loop): result = await bot.get_chat_member(chat_id=chat.id, user_id=member.user.id) assert isinstance(result, types.ChatMember) assert result == member
async def test_get_chat_administrators(bot: Bot, event_loop): """ getChatAdministrators method test """ from .types.dataset import CHAT, CHAT_MEMBER chat = types.Chat(**CHAT) member = types.ChatMember(**CHAT_MEMBER) async with FakeTelegram(message_data=[CHAT_MEMBER, CHAT_MEMBER], loop=event_loop): result = await bot.get_chat_administrators(chat_id=chat.id) assert result[0] == member assert len(result) == 2
from aiogram import types from .dataset import CHAT_MEMBER chat_member = types.ChatMember(**CHAT_MEMBER) def test_export(): exported = chat_member.to_python() assert isinstance(exported, dict) assert exported == CHAT_MEMBER def test_user(): assert isinstance(chat_member.user, types.User) def test_status(): assert isinstance(chat_member.status, str) assert chat_member.status == CHAT_MEMBER['status'] def test_privileges(): assert isinstance(chat_member.can_be_edited, bool) assert chat_member.can_be_edited == CHAT_MEMBER['can_be_edited'] assert isinstance(chat_member.can_change_info, bool) assert chat_member.can_change_info == CHAT_MEMBER['can_change_info'] assert isinstance(chat_member.can_delete_messages, bool) assert chat_member.can_delete_messages == CHAT_MEMBER[ 'can_delete_messages']