mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Beta 3 (#884)
* Rework middlewares, separate management to `MiddlewareManager` class * Rework middlewares * Added changes description for redis * Added changes description for redis * Fixed tests with Redis // aioredis replacement * Changed msg.<html/md>_text attributes behaviour * Added changelog for spoilers * Added possibility to get command magic result as handler arguments
This commit is contained in:
parent
930bca0876
commit
286cf39c8a
51 changed files with 1380 additions and 804 deletions
|
|
@ -111,8 +111,8 @@ class TestSimpleI18nMiddleware:
|
|||
middleware = SimpleI18nMiddleware(i18n=i18n)
|
||||
middleware.setup(router=dp)
|
||||
|
||||
assert middleware not in dp.update.outer_middlewares
|
||||
assert middleware in dp.message.outer_middlewares
|
||||
assert middleware not in dp.update.outer_middleware
|
||||
assert middleware in dp.message.outer_middleware
|
||||
|
||||
async def test_get_unknown_locale(self, i18n: I18n):
|
||||
dp = Dispatcher()
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ from typing import Any, Dict
|
|||
|
||||
import pytest
|
||||
|
||||
from aiogram.utils.link import create_telegram_link, create_tg_link
|
||||
from aiogram.utils.link import BRANCH, create_telegram_link, create_tg_link, docs_url
|
||||
|
||||
|
||||
class TestLink:
|
||||
|
|
@ -22,3 +22,12 @@ class TestLink:
|
|||
)
|
||||
def test_create_telegram_link(self, base: str, params: Dict[str, Any], result: str):
|
||||
assert create_telegram_link(base, **params) == result
|
||||
|
||||
def test_fragment(self):
|
||||
assert (
|
||||
docs_url("test.html", fragment_="test")
|
||||
== f"https://docs.aiogram.dev/en/{BRANCH}/test.html#test"
|
||||
)
|
||||
|
||||
def test_docs(self):
|
||||
assert docs_url("test.html") == f"https://docs.aiogram.dev/en/{BRANCH}/test.html"
|
||||
|
|
|
|||
|
|
@ -47,6 +47,11 @@ class TestTextDecoration:
|
|||
'<a href="tg://user?id=42">test</a>',
|
||||
],
|
||||
[html_decoration, MessageEntity(type="url", offset=0, length=5), "test"],
|
||||
[
|
||||
html_decoration,
|
||||
MessageEntity(type="spoiler", offset=0, length=5),
|
||||
'<span class="tg-spoiler">test</span>',
|
||||
],
|
||||
[
|
||||
html_decoration,
|
||||
MessageEntity(type="text_link", offset=0, length=5, url="https://aiogram.dev"),
|
||||
|
|
@ -76,6 +81,7 @@ class TestTextDecoration:
|
|||
[markdown_decoration, MessageEntity(type="bot_command", offset=0, length=5), "test"],
|
||||
[markdown_decoration, MessageEntity(type="email", offset=0, length=5), "test"],
|
||||
[markdown_decoration, MessageEntity(type="phone_number", offset=0, length=5), "test"],
|
||||
[markdown_decoration, MessageEntity(type="spoiler", offset=0, length=5), "|test|"],
|
||||
[
|
||||
markdown_decoration,
|
||||
MessageEntity(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue