Small changes in tests

This commit is contained in:
Alex Root Junior 2021-06-15 02:01:57 +03:00
parent 7f0a9d8097
commit 5296724a0f
2 changed files with 9 additions and 3 deletions

View file

@ -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)

View file

@ -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",
}