mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Added full support of Bot API 7.9 (#1560)
* Added full support of Bot API 7.9 * Added changelog * Try to fix towncrier * Fixed towncrier check
This commit is contained in:
parent
1c323ecc97
commit
c3a08664d3
48 changed files with 817 additions and 114 deletions
|
|
@ -0,0 +1,32 @@
|
|||
from datetime import timedelta
|
||||
|
||||
from aiogram.methods import (
|
||||
CreateChatInviteLink,
|
||||
CreateChatSubscriptionInviteLink,
|
||||
Request,
|
||||
)
|
||||
from aiogram.types import ChatInviteLink, User
|
||||
from tests.mocked_bot import MockedBot
|
||||
|
||||
|
||||
class TestCreateChatSubscriptionInviteLink:
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(
|
||||
CreateChatSubscriptionInviteLink,
|
||||
ok=True,
|
||||
result=ChatInviteLink(
|
||||
invite_link="https://t.me/username",
|
||||
creator=User(id=42, is_bot=False, first_name="User"),
|
||||
is_primary=False,
|
||||
is_revoked=False,
|
||||
creates_join_request=False,
|
||||
),
|
||||
)
|
||||
|
||||
response: ChatInviteLink = await bot.create_chat_subscription_invite_link(
|
||||
chat_id=-42,
|
||||
subscription_period=timedelta(days=30),
|
||||
subscription_price=42,
|
||||
)
|
||||
request = bot.get_request()
|
||||
assert response == prepare_result.result
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
from datetime import timedelta
|
||||
|
||||
from aiogram.methods import (
|
||||
CreateChatInviteLink,
|
||||
CreateChatSubscriptionInviteLink,
|
||||
EditChatSubscriptionInviteLink,
|
||||
Request,
|
||||
)
|
||||
from aiogram.types import ChatInviteLink, User
|
||||
from tests.mocked_bot import MockedBot
|
||||
|
||||
|
||||
class TestEditChatSubscriptionInviteLink:
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(
|
||||
EditChatSubscriptionInviteLink,
|
||||
ok=True,
|
||||
result=ChatInviteLink(
|
||||
invite_link="https://t.me/username",
|
||||
creator=User(id=42, is_bot=False, first_name="User"),
|
||||
is_primary=False,
|
||||
is_revoked=False,
|
||||
creates_join_request=False,
|
||||
),
|
||||
)
|
||||
|
||||
response: ChatInviteLink = await bot.edit_chat_subscription_invite_link(
|
||||
chat_id=-42,
|
||||
invite_link="https://t.me/username/test",
|
||||
name="test",
|
||||
)
|
||||
request = bot.get_request()
|
||||
assert response == prepare_result.result
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
from unittest.mock import patch
|
||||
from datetime import datetime
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
|
|
@ -9,13 +9,13 @@ from aiogram.dispatcher.middlewares.user_context import (
|
|||
)
|
||||
from aiogram.types import (
|
||||
Chat,
|
||||
Update,
|
||||
User,
|
||||
ChatBoostUpdated,
|
||||
ChatBoost,
|
||||
ChatBoostSourcePremium,
|
||||
ChatBoostSourceGiftCode,
|
||||
ChatBoostSourceGiveaway,
|
||||
ChatBoostSourcePremium,
|
||||
ChatBoostUpdated,
|
||||
Update,
|
||||
User,
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue