mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Dev 2.x api 5.4 (#741)
* Added support of Bot API 5.4 * Bump version * Added aliases for ChatJoinRequest object * Create aiohttp session inside async function * Try to fix compatibility with aiohttp 3.8 * Fixed compatibility with Python 3.10
This commit is contained in:
parent
b98ec3efad
commit
b190bbba19
22 changed files with 302 additions and 91 deletions
|
|
@ -23,7 +23,6 @@ class TestAiohttpSession:
|
|||
|
||||
assert bot._session is None
|
||||
|
||||
assert isinstance(bot.session, aiohttp.ClientSession)
|
||||
assert bot.session == bot._session
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
|
@ -51,11 +50,11 @@ class TestAiohttpSession:
|
|||
@pytest.mark.asyncio
|
||||
async def test_close_session(self):
|
||||
bot = BaseBot(token="42:correct",)
|
||||
aiohttp_client_0 = bot.session
|
||||
aiohttp_client_0 = await bot.get_session()
|
||||
|
||||
with patch("aiohttp.ClientSession.close", new=CoroutineMock()) as mocked_close:
|
||||
await aiohttp_client_0.close()
|
||||
mocked_close.assert_called_once()
|
||||
|
||||
await aiohttp_client_0.close()
|
||||
assert aiohttp_client_0 != bot.session # will create new session
|
||||
assert aiohttp_client_0 != await bot.get_session() # will create new session
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ async def bot_fixture():
|
|||
""" Bot fixture """
|
||||
_bot = Bot(TOKEN)
|
||||
yield _bot
|
||||
await _bot.session.close()
|
||||
await (await _bot.get_session()).close()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue