mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Add support for Telegram Bot API 9.1 (#1704)
* Add support for Telegram Bot API 9.1 features, including checklists, gifts, and new methods like `SendChecklist`, `EditMessageChecklist`, and `GetMyStarBalance`. Update changelog and improve `True` field descriptions. * Bump API Version * Refactor profile photo types to use `InputProfilePhotoType` enums instead of hardcoded literals * Refactor imports and clean up redundant code across methods, types, and webhook server classes
This commit is contained in:
parent
77ca49518e
commit
f060c08d16
117 changed files with 2565 additions and 466 deletions
35
tests/test_api/test_methods/test_edit_message_checklist.py
Normal file
35
tests/test_api/test_methods/test_edit_message_checklist.py
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
import datetime
|
||||
|
||||
from aiogram.methods import EditMessageChecklist
|
||||
from aiogram.types import Chat, InputChecklist, InputChecklistTask, Message
|
||||
from tests.mocked_bot import MockedBot
|
||||
|
||||
|
||||
class TestEditMessageChecklist:
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(
|
||||
EditMessageChecklist,
|
||||
ok=True,
|
||||
result=Message(
|
||||
message_id=42,
|
||||
date=datetime.datetime.now(),
|
||||
chat=Chat(id=42, type="private"),
|
||||
),
|
||||
)
|
||||
|
||||
checklist = InputChecklist(
|
||||
title="Updated Checklist",
|
||||
tasks=[
|
||||
InputChecklistTask(id=1, text="Updated Task 1"),
|
||||
InputChecklistTask(id=2, text="Updated Task 2"),
|
||||
],
|
||||
)
|
||||
|
||||
response: Message = await bot.edit_message_checklist(
|
||||
business_connection_id="test_connection",
|
||||
chat_id=42,
|
||||
message_id=42,
|
||||
checklist=checklist,
|
||||
)
|
||||
request = bot.get_request()
|
||||
assert response == prepare_result.result
|
||||
18
tests/test_api/test_methods/test_get_my_star_balance.py
Normal file
18
tests/test_api/test_methods/test_get_my_star_balance.py
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
from aiogram.methods import GetMyStarBalance
|
||||
from aiogram.types import StarAmount
|
||||
from tests.mocked_bot import MockedBot
|
||||
|
||||
|
||||
class TestGetMyStarBalance:
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(
|
||||
GetMyStarBalance,
|
||||
ok=True,
|
||||
result=StarAmount(
|
||||
amount=100,
|
||||
),
|
||||
)
|
||||
|
||||
response: StarAmount = await bot.get_my_star_balance()
|
||||
request = bot.get_request()
|
||||
assert response == prepare_result.result
|
||||
34
tests/test_api/test_methods/test_send_checklist.py
Normal file
34
tests/test_api/test_methods/test_send_checklist.py
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
import datetime
|
||||
|
||||
from aiogram.methods import SendChecklist
|
||||
from aiogram.types import Chat, InputChecklist, InputChecklistTask, Message
|
||||
from tests.mocked_bot import MockedBot
|
||||
|
||||
|
||||
class TestSendChecklist:
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(
|
||||
SendChecklist,
|
||||
ok=True,
|
||||
result=Message(
|
||||
message_id=42,
|
||||
date=datetime.datetime.now(),
|
||||
chat=Chat(id=42, type="private"),
|
||||
),
|
||||
)
|
||||
|
||||
checklist = InputChecklist(
|
||||
title="Test Checklist",
|
||||
tasks=[
|
||||
InputChecklistTask(id=1, text="Task 1"),
|
||||
InputChecklistTask(id=2, text="Task 2"),
|
||||
],
|
||||
)
|
||||
|
||||
response: Message = await bot.send_checklist(
|
||||
business_connection_id="test_connection",
|
||||
chat_id=42,
|
||||
checklist=checklist,
|
||||
)
|
||||
request = bot.get_request()
|
||||
assert response == prepare_result.result
|
||||
Loading…
Add table
Add a link
Reference in a new issue