mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Added full support for the Bot API 9.6 (#1792)
* Added full support for the Bot API 9.6 * Add support for `managed_bot` updates * Set `description_parse_mode` default to `"parse_mode"` and use `DateTime` for `addition_date` in `PollOption` * Update changelog with features and changes from Bot API 9.6 * Add changelog fragment generator and update poll parameter descriptions
This commit is contained in:
parent
00c1130938
commit
9f49c0413f
107 changed files with 3077 additions and 328 deletions
45
.serena/memories/testing_patterns.md
Normal file
45
.serena/memories/testing_patterns.md
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
# Testing Patterns
|
||||
|
||||
## Framework
|
||||
- pytest with async support
|
||||
- No `pytest-asyncio` explicit marks needed (configured globally in pyproject.toml)
|
||||
- `MockedBot` (tests/mocked_bot.py) — use for all bot method tests, no real HTTP
|
||||
|
||||
## MockedBot pattern
|
||||
```python
|
||||
from tests.mocked_bot import MockedBot
|
||||
from aiogram.methods import SendMessage
|
||||
from aiogram.types import Message, Chat
|
||||
import datetime
|
||||
|
||||
class TestSendMessage:
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(
|
||||
SendMessage,
|
||||
ok=True,
|
||||
result=Message(
|
||||
message_id=42,
|
||||
date=datetime.datetime.now(),
|
||||
text="test",
|
||||
chat=Chat(id=42, type="private"),
|
||||
),
|
||||
)
|
||||
response: Message = await bot.send_message(chat_id=42, text="test")
|
||||
bot.get_request()
|
||||
assert response == prepare_result.result
|
||||
```
|
||||
|
||||
## Test structure
|
||||
- Class per type/method: `class TestSendMessage:`
|
||||
- One test per scenario: `async def test_<scenario>(self, ...)`
|
||||
- `bot` fixture comes from `tests/conftest.py`
|
||||
|
||||
## Integration tests
|
||||
- Redis: `uv run pytest --redis redis://localhost:6379/0 tests`
|
||||
- MongoDB: `uv run pytest --mongo mongodb://mongo:mongo@localhost:27017 tests`
|
||||
- Only run these when Redis/Mongo storage code is affected
|
||||
|
||||
## What NOT to do
|
||||
- Do not mock the database/storage in FSM tests — use real backends or memory storage
|
||||
- Do not introduce new test dependencies for small tests
|
||||
- Keep test style consistent with existing suite
|
||||
Loading…
Add table
Add a link
Reference in a new issue