Added full support of Bot API 7.9

This commit is contained in:
JRoot Junior 2024-08-15 00:20:52 +03:00
parent 1c323ecc97
commit 7b14f59e29
No known key found for this signature in database
GPG key ID: 738964250D5FF6E2
45 changed files with 786 additions and 105 deletions

View file

@ -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

View file

@ -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

View file

@ -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,
)