Refactoring while review

This commit is contained in:
Rishat Fayzullin 2024-03-13 22:39:07 +03:00
parent a24327455a
commit 8567496b77
2 changed files with 4 additions and 4 deletions

View file

@ -1,6 +1,6 @@
from typing import Any, Dict, Optional, cast
from motor.motor_asyncio import AsyncIOMotorClient, AsyncIOMotorCollection
from motor.motor_asyncio import AsyncIOMotorClient
from aiogram.fsm.state import State
from aiogram.fsm.storage.base import (
@ -33,8 +33,8 @@ class MongoStorage(BaseStorage):
if key_builder is None:
key_builder = DefaultKeyBuilder()
self._client = client
self._db_name = db_name
self._collection: AsyncIOMotorCollection = self._client[db_name][collection_name]
self._database = self._client[db_name]
self._collection = self._database[collection_name]
self._key_builder = key_builder
@classmethod

View file

@ -86,7 +86,7 @@ async def mongo_storage(mongo_server):
pytest.skip(str(e))
else:
yield storage
await storage._client.drop_database(storage._db_name)
await storage._client.drop_database(storage._database)
finally:
await storage.close()