mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
#296 Added test for getting bot's user_id
This commit is contained in:
parent
8cd781048a
commit
cd75d3c468
2 changed files with 9 additions and 2 deletions
|
|
@ -2,7 +2,8 @@ import aresponses
|
||||||
|
|
||||||
from aiogram import Bot
|
from aiogram import Bot
|
||||||
|
|
||||||
TOKEN = '123456789:AABBCCDDEEFFaabbccddeeff-1234567890'
|
BOT_ID = 123456789
|
||||||
|
TOKEN = f'{BOT_ID}:AABBCCDDEEFFaabbccddeeff-1234567890'
|
||||||
|
|
||||||
|
|
||||||
class FakeTelegram(aresponses.ResponsesMockServer):
|
class FakeTelegram(aresponses.ResponsesMockServer):
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from aiogram import Bot, types
|
from aiogram import Bot, types
|
||||||
from . import FakeTelegram, TOKEN
|
from . import FakeTelegram, TOKEN, BOT_ID
|
||||||
|
|
||||||
pytestmark = pytest.mark.asyncio
|
pytestmark = pytest.mark.asyncio
|
||||||
|
|
||||||
|
|
@ -525,3 +525,9 @@ async def test_set_sticker_set_thumb(bot: Bot, event_loop):
|
||||||
result = await bot.set_sticker_set_thumb(name='test', user_id=123456789, thumb='file_id')
|
result = await bot.set_sticker_set_thumb(name='test', user_id=123456789, thumb='file_id')
|
||||||
assert isinstance(result, bool)
|
assert isinstance(result, bool)
|
||||||
assert result is True
|
assert result is True
|
||||||
|
|
||||||
|
|
||||||
|
async def test_bot_id(bot: Bot):
|
||||||
|
""" Check getting id from token. """
|
||||||
|
bot = Bot(TOKEN)
|
||||||
|
assert bot.id == BOT_ID # BOT_ID is a correct id from TOKEN
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue