aiogram/tests/test_api/test_methods/test_get_me.py

19 lines
621 B
Python
Raw Normal View History

from aiogram.methods import GetMe, Request
from aiogram.types import User
2019-11-18 17:44:07 +02:00
from tests.mocked_bot import MockedBot
class TestGetMe:
async def test_bot_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(
GetMe, ok=True, result=User(id=42, is_bot=False, first_name="User")
)
response: User = await bot.get_me()
request = bot.get_request()
2019-11-18 17:44:07 +02:00
assert response == prepare_result.result
2019-12-04 18:04:29 +02:00
async def test_me_property(self, bot: MockedBot):
response: User = await bot.me()
assert isinstance(response, User)
assert response == bot._me