Add restrictChatMember test

This commit is contained in:
Oleg Abramov 2018-04-04 18:14:42 +03:00
parent 28484d9352
commit 3548febeaf

View file

@ -307,3 +307,21 @@ async def test_unban_chat_member(bot: Bot, event_loop):
result = await bot.unban_chat_member(chat_id=chat.id, user_id=user.id) result = await bot.unban_chat_member(chat_id=chat.id, user_id=user.id)
assert isinstance(result, bool) assert isinstance(result, bool)
assert result is True assert result is True
@pytest.mark.asyncio
async def test_restrict_chat_member(bot: Bot, event_loop):
""" restrictChatMember method test """
from .types.dataset import USER, CHAT
user = types.User(**USER)
chat = types.Chat(**CHAT)
async with FakeTelegram(message_dict=True, loop=event_loop):
result = await bot.restrict_chat_member(chat_id=chat.id, user_id=user.id,
can_add_web_page_previews=False,
can_send_media_messages=False,
can_send_messages=False,
can_send_other_messages=False,
until_date=123)
assert isinstance(result, bool)
assert result is True