diff --git a/tests/conftest.py b/tests/conftest.py index 92dd97fe..7586f389 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -63,6 +63,8 @@ async def memory_storage(): def bot(): bot = MockedBot() token = Bot.set_current(bot) - yield bot - Bot.reset_current(token) - bot.me.invalidate(bot) + try: + yield bot + finally: + Bot.reset_current(token) + bot.me.invalidate(bot) diff --git a/tests/test_dispatcher/test_fsm/storage/test_storages.py b/tests/test_dispatcher/test_fsm/storage/test_storages.py index fcb2deae..cae3cb2c 100644 --- a/tests/test_dispatcher/test_fsm/storage/test_storages.py +++ b/tests/test_dispatcher/test_fsm/storage/test_storages.py @@ -42,3 +42,7 @@ class TestStorages: assert await storage.update_data( bot=bot, chat_id=-42, user_id=42, data={"baz": "spam"} ) == {"foo": "bar", "baz": "spam"} + assert await storage.get_data(bot=bot, chat_id=-42, user_id=42) == { + "foo": "bar", + "baz": "spam", + }