mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Add to ChatMemberOwner new default fields (#645)
* new: add field type ConstField * new: add const fields for ChatMemberOwner * new: better typings for get_chat_administrators * new: add tests for chat owner fields * fix: Type typing for class * enh: alias is_chat_owner for is_chat_creator
This commit is contained in:
parent
7feb0cade0
commit
f6f2972a11
6 changed files with 59 additions and 13 deletions
|
|
@ -425,14 +425,19 @@ async def test_get_chat(bot: Bot):
|
|||
|
||||
async def test_get_chat_administrators(bot: Bot):
|
||||
""" getChatAdministrators method test """
|
||||
from .types.dataset import CHAT, CHAT_MEMBER
|
||||
from .types.dataset import CHAT, CHAT_MEMBER, CHAT_MEMBER_OWNER
|
||||
chat = types.Chat(**CHAT)
|
||||
member = types.ChatMember.resolve(**CHAT_MEMBER)
|
||||
owner = types.ChatMember.resolve(**CHAT_MEMBER_OWNER)
|
||||
|
||||
async with FakeTelegram(message_data=[CHAT_MEMBER, CHAT_MEMBER]):
|
||||
async with FakeTelegram(message_data=[CHAT_MEMBER, CHAT_MEMBER_OWNER]):
|
||||
result = await bot.get_chat_administrators(chat_id=chat.id)
|
||||
assert result[0] == member
|
||||
assert result[1] == owner
|
||||
assert len(result) == 2
|
||||
for m in result:
|
||||
assert m.is_chat_admin()
|
||||
assert hasattr(m, "can_be_edited")
|
||||
|
||||
|
||||
async def test_get_chat_member_count(bot: Bot):
|
||||
|
|
|
|||
|
|
@ -44,12 +44,21 @@ CHAT_MEMBER = {
|
|||
"user": USER,
|
||||
"status": "administrator",
|
||||
"can_be_edited": False,
|
||||
"can_manage_chat": True,
|
||||
"can_change_info": True,
|
||||
"can_delete_messages": True,
|
||||
"can_invite_users": True,
|
||||
"can_restrict_members": True,
|
||||
"can_pin_messages": True,
|
||||
"can_promote_members": False,
|
||||
"can_manage_voice_chats": True,
|
||||
"is_anonymous": False,
|
||||
}
|
||||
|
||||
CHAT_MEMBER_OWNER = {
|
||||
"user": USER,
|
||||
"status": "creator",
|
||||
"is_anonymous": False,
|
||||
}
|
||||
|
||||
CONTACT = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue