mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-14 19:00:23 +00:00
Forum topic in FSM (#1161)
* Base implementation * Added tests, fixed arguments priority * Use `Optional[X]` instead of `X | None` * Added changelog * Added tests
This commit is contained in:
parent
1538bc2e2d
commit
942ba0d520
10 changed files with 164 additions and 60 deletions
|
|
@ -11,6 +11,7 @@ PREFIX = "test"
|
|||
BOT_ID = 42
|
||||
CHAT_ID = -1
|
||||
USER_ID = 2
|
||||
THREAD_ID = 3
|
||||
FIELD = "data"
|
||||
|
||||
|
||||
|
|
@ -46,6 +47,19 @@ class TestRedisDefaultKeyBuilder:
|
|||
with pytest.raises(ValueError):
|
||||
key_builder.build(key, FIELD)
|
||||
|
||||
def test_thread_id(self):
|
||||
key_builder = DefaultKeyBuilder(
|
||||
prefix=PREFIX,
|
||||
)
|
||||
key = StorageKey(
|
||||
chat_id=CHAT_ID,
|
||||
user_id=USER_ID,
|
||||
bot_id=BOT_ID,
|
||||
thread_id=THREAD_ID,
|
||||
destiny=DEFAULT_DESTINY,
|
||||
)
|
||||
assert key_builder.build(key, FIELD) == f"{PREFIX}:{CHAT_ID}:{THREAD_ID}:{USER_ID}:{FIELD}"
|
||||
|
||||
def test_create_isolation(self):
|
||||
fake_redis = object()
|
||||
storage = RedisStorage(redis=fake_redis)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue