aiogram/tests/test_dispatcher
Alex Root Junior 74e00a30b1
"Add get_mounted_bot function and improve model comparison in tests"
In this commit, a new function `get_mounted_bot` was added to `context_controller.py` that returns the bot mounted in context. This function was needed to bypass the limitation in pydantic BaseModel's properties, which neither support computed fields nor serialization/validation.

Various tests were also updated to compare models using `model_dump_json()` method rather than comparing the models directly. This change provides more accurate comparisons by considering default values in the models.

Further, the dispatcher was adjusted to enforce update re-mounting if the mounted bot differs from the current update. This allows shortcuts to be used in the bot's current instance and ensures the correct propagation of the context to all the nested objects and attributes of Updates.
2023-07-16 22:46:45 +03:00
..
test_event Bump dependencies 2023-02-12 01:24:18 +02:00
test_middlewares Forum topic in FSM (#1161) 2023-04-22 19:35:41 +03:00
__init__.py Add tests for handler 2019-11-24 00:17:21 +02:00
test_dispatcher.py "Add get_mounted_bot function and improve model comparison in tests" 2023-07-16 22:46:45 +03:00
test_router.py skip if current router does not have observer for custom event (#1147) 2023-04-08 17:39:48 +03:00