From 3548febeaf70cab5fa7eb53e176bf0faa6fa20f1 Mon Sep 17 00:00:00 2001 From: Oleg Abramov Date: Wed, 4 Apr 2018 18:14:42 +0300 Subject: [PATCH] Add restrictChatMember test --- tests/test_bot.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/test_bot.py b/tests/test_bot.py index 59fad67c..0c3b0667 100644 --- a/tests/test_bot.py +++ b/tests/test_bot.py @@ -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) assert isinstance(result, bool) 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