mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-12 18:19:34 +00:00
Backport and improvements (#601)
* Backport RedisStorage, deep-linking * Allow prereleases for aioredis * Bump dependencies * Correctly skip Redis tests on Windows * Reformat tests code and bump Makefile
This commit is contained in:
parent
32bc05130f
commit
83d6ab48c5
43 changed files with 1004 additions and 327 deletions
21
tests/test_dispatcher/test_fsm/storage/test_redis.py
Normal file
21
tests/test_dispatcher/test_fsm/storage/test_redis.py
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import pytest
|
||||
|
||||
from aiogram.dispatcher.fsm.storage.redis import RedisStorage
|
||||
from tests.mocked_bot import MockedBot
|
||||
|
||||
|
||||
@pytest.mark.redis
|
||||
class TestRedisStorage:
|
||||
@pytest.mark.parametrize(
|
||||
"prefix_bot,result",
|
||||
[
|
||||
[False, "fsm:-1:2"],
|
||||
[True, "fsm:42:-1:2"],
|
||||
[{42: "kaboom"}, "fsm:kaboom:-1:2"],
|
||||
[lambda bot: "kaboom", "fsm:kaboom:-1:2"],
|
||||
],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
async def test_generate_key(self, bot: MockedBot, redis_server, prefix_bot, result):
|
||||
storage = RedisStorage.from_url(redis_server, prefix_bot=prefix_bot)
|
||||
assert storage.generate_key(bot, -1, 2) == result
|
||||
Loading…
Add table
Add a link
Reference in a new issue