mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Added full support for the Bot API 9.6 (#1792)
* Added full support for the Bot API 9.6 * Add support for `managed_bot` updates * Set `description_parse_mode` default to `"parse_mode"` and use `DateTime` for `addition_date` in `PollOption` * Update changelog with features and changes from Bot API 9.6 * Add changelog fragment generator and update poll parameter descriptions
This commit is contained in:
parent
00c1130938
commit
9f49c0413f
107 changed files with 3077 additions and 328 deletions
11
tests/test_api/test_methods/test_get_managed_bot_token.py
Normal file
11
tests/test_api/test_methods/test_get_managed_bot_token.py
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
from aiogram.methods import GetManagedBotToken
|
||||
from tests.mocked_bot import MockedBot
|
||||
|
||||
|
||||
class TestGetManagedBotToken:
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(GetManagedBotToken, ok=True, result="42:NEW_TOKEN")
|
||||
|
||||
response: str = await bot.get_managed_bot_token(user_id=42)
|
||||
bot.get_request()
|
||||
assert response == prepare_result.result
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
from aiogram.methods import ReplaceManagedBotToken
|
||||
from tests.mocked_bot import MockedBot
|
||||
|
||||
|
||||
class TestReplaceManagedBotToken:
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(
|
||||
ReplaceManagedBotToken, ok=True, result="42:REPLACED_TOKEN"
|
||||
)
|
||||
|
||||
response: str = await bot.replace_managed_bot_token(user_id=42)
|
||||
bot.get_request()
|
||||
assert response == prepare_result.result
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
from aiogram.methods import SavePreparedKeyboardButton
|
||||
from aiogram.types import KeyboardButton, KeyboardButtonRequestManagedBot, PreparedKeyboardButton
|
||||
from tests.mocked_bot import MockedBot
|
||||
|
||||
|
||||
class TestSavePreparedKeyboardButton:
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(
|
||||
SavePreparedKeyboardButton,
|
||||
ok=True,
|
||||
result=PreparedKeyboardButton(id="test-id"),
|
||||
)
|
||||
|
||||
response: PreparedKeyboardButton = await bot.save_prepared_keyboard_button(
|
||||
user_id=42,
|
||||
button=KeyboardButton(
|
||||
text="Create bot",
|
||||
request_managed_bot=KeyboardButtonRequestManagedBot(request_id=1),
|
||||
),
|
||||
)
|
||||
bot.get_request()
|
||||
assert response == prepare_result.result
|
||||
|
|
@ -17,13 +17,14 @@ class TestSendPoll:
|
|||
id="QA",
|
||||
question="Q",
|
||||
options=[
|
||||
PollOption(text="A", voter_count=0),
|
||||
PollOption(text="B", voter_count=0),
|
||||
PollOption(persistent_id="1", text="A", voter_count=0),
|
||||
PollOption(persistent_id="2", text="B", voter_count=0),
|
||||
],
|
||||
is_closed=False,
|
||||
is_anonymous=False,
|
||||
type="quiz",
|
||||
allows_multiple_answers=False,
|
||||
allows_revoting=False,
|
||||
total_voter_count=0,
|
||||
correct_option_id=0,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -11,11 +11,15 @@ class TestStopPoll:
|
|||
result=Poll(
|
||||
id="QA",
|
||||
question="Q",
|
||||
options=[PollOption(text="A", voter_count=0), PollOption(text="B", voter_count=0)],
|
||||
options=[
|
||||
PollOption(persistent_id="1", text="A", voter_count=0),
|
||||
PollOption(persistent_id="2", text="B", voter_count=0),
|
||||
],
|
||||
is_closed=False,
|
||||
is_anonymous=False,
|
||||
type="quiz",
|
||||
allows_multiple_answers=False,
|
||||
allows_revoting=False,
|
||||
total_voter_count=0,
|
||||
correct_option_id=0,
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue