mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Added full support of Bot API 8.2 (#1623)
* Added full support of Bot API 8.2 * Added changelog * Try to add port * Add port to the `test_reset_connector`
This commit is contained in:
parent
81550997f7
commit
afccd8a38f
41 changed files with 811 additions and 85 deletions
|
|
@ -41,7 +41,7 @@ class TestAiohttpSession:
|
|||
|
||||
async def test_create_proxy_session(self):
|
||||
auth = aiohttp.BasicAuth("login", "password", "encoding")
|
||||
async with AiohttpSession(proxy=("socks5://proxy.url/", auth)) as session:
|
||||
async with AiohttpSession(proxy=("socks5://proxy.url:1080/", auth)) as session:
|
||||
assert session._connector_type == aiohttp_socks.ProxyConnector
|
||||
|
||||
assert isinstance(session._connector_init, dict)
|
||||
|
|
@ -51,7 +51,7 @@ class TestAiohttpSession:
|
|||
assert isinstance(aiohttp_session.connector, aiohttp_socks.ProxyConnector)
|
||||
|
||||
async def test_create_proxy_session_proxy_url(self):
|
||||
async with AiohttpSession(proxy="socks4://proxy.url/") as session:
|
||||
async with AiohttpSession(proxy="socks4://proxy.url:1080/") as session:
|
||||
assert isinstance(session.proxy, str)
|
||||
|
||||
assert isinstance(session._connector_init, dict)
|
||||
|
|
@ -62,8 +62,8 @@ class TestAiohttpSession:
|
|||
|
||||
async def test_create_proxy_session_chained_proxies(self):
|
||||
proxy_chain = [
|
||||
"socks4://proxy.url/",
|
||||
"socks5://proxy.url/",
|
||||
"socks4://proxy.url:1080/",
|
||||
"socks5://proxy.url:1080/",
|
||||
"http://user:password@127.0.0.1:3128",
|
||||
]
|
||||
async with AiohttpSession(proxy=proxy_chain) as session:
|
||||
|
|
@ -90,7 +90,7 @@ class TestAiohttpSession:
|
|||
assert session._should_reset_connector is False
|
||||
|
||||
assert session.proxy is None
|
||||
session.proxy = "socks5://auth:auth@proxy.url/"
|
||||
session.proxy = "socks5://auth:auth@proxy.url:1080/"
|
||||
assert session._should_reset_connector
|
||||
await session.create_session()
|
||||
assert session._should_reset_connector is False
|
||||
|
|
|
|||
12
tests/test_api/test_methods/test_remove_chat_verification.py
Normal file
12
tests/test_api/test_methods/test_remove_chat_verification.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
from aiogram.methods import RemoveChatVerification, VerifyChat
|
||||
from aiogram.types import Poll
|
||||
from tests.mocked_bot import MockedBot
|
||||
|
||||
|
||||
class TestRemoveChatVerification:
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(RemoveChatVerification, ok=True, result=True)
|
||||
|
||||
response: bool = await bot.remove_chat_verification(chat_id=42)
|
||||
request = bot.get_request()
|
||||
assert response == prepare_result.result
|
||||
12
tests/test_api/test_methods/test_remove_user_verification.py
Normal file
12
tests/test_api/test_methods/test_remove_user_verification.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
from aiogram.methods import RemoveUserVerification, VerifyChat
|
||||
from aiogram.types import Poll
|
||||
from tests.mocked_bot import MockedBot
|
||||
|
||||
|
||||
class TestRemoveUserVerification:
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(RemoveUserVerification, ok=True, result=True)
|
||||
|
||||
response: bool = await bot.remove_user_verification(user_id=42)
|
||||
request = bot.get_request()
|
||||
assert response == prepare_result.result
|
||||
12
tests/test_api/test_methods/test_verify_chat.py
Normal file
12
tests/test_api/test_methods/test_verify_chat.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
from aiogram.methods import VerifyChat
|
||||
from aiogram.types import Poll
|
||||
from tests.mocked_bot import MockedBot
|
||||
|
||||
|
||||
class TestVerifyChat:
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(VerifyChat, ok=True, result=True)
|
||||
|
||||
response: bool = await bot.verify_chat(chat_id=42)
|
||||
request = bot.get_request()
|
||||
assert response == prepare_result.result
|
||||
12
tests/test_api/test_methods/test_verify_user.py
Normal file
12
tests/test_api/test_methods/test_verify_user.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
from aiogram.methods import VerifyChat, VerifyUser
|
||||
from aiogram.types import Poll
|
||||
from tests.mocked_bot import MockedBot
|
||||
|
||||
|
||||
class TestVerifyUser:
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(VerifyUser, ok=True, result=True)
|
||||
|
||||
response: bool = await bot.verify_user(user_id=42)
|
||||
request = bot.get_request()
|
||||
assert response == prepare_result.result
|
||||
Loading…
Add table
Add a link
Reference in a new issue