aiogram/tests/test_fsm/storage/test_isolation.py
RootShinobi dbaf6fabcb
storage cleanup (#1144)
* storage cleanup

* storage cleanup
2023-04-08 18:01:11 +03:00

27 lines
707 B
Python

import pytest
from aiogram.fsm.storage.base import BaseEventIsolation, StorageKey
from tests.mocked_bot import MockedBot
@pytest.fixture(name="storage_key")
def create_storage_key(bot: MockedBot):
return StorageKey(chat_id=-42, user_id=42, bot_id=bot.id)
@pytest.mark.parametrize(
"isolation",
[
pytest.lazy_fixture("redis_isolation"),
pytest.lazy_fixture("lock_isolation"),
pytest.lazy_fixture("disabled_isolation"),
],
)
class TestIsolations:
async def test_lock(
self,
isolation: BaseEventIsolation,
storage_key: StorageKey,
):
async with isolation.lock(key=storage_key):
assert True, "You are kidding me?"