mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-14 19:00:23 +00:00
Handle expected warnings & raise unexpected warnings (#1315)
* chore: replace fixture loop with event_loop
* chore: mark expected warnings
* chore: raise unexpected warnings
* chore: rm unused record
* fix: rm parenthesized context manager
* chore: warnings shall not pass
* chore: replace fixture loop with event_loop
* chore: mark expected warnings
* chore: raise unexpected warnings
* chore: rm unused record
* fix: rm parenthesized context manager
* chore: warnings shall not pass
* Revert "chore: raise unexpected warnings"
This reverts commit 4c91df243d.
* chore: warnings shall not pass v2
* fix: graceful aiohttp session close
* chore: minor typo
* chore: mark expected warnings
* fix: temporary mute ResourceWarning
#1320
* fix: close pool with redis
* chore: code reformat and lint
* chore: simplify tests with fixture
* chore: make aresponses clear
* chore: divide asserts with blank line
* chore: rm duplicated assertions
* chore: rm unnecessary extra
* chore: bump test dependencies
* chore: bump test dependencies (fix)
This commit is contained in:
parent
890a57cd15
commit
eacea996d4
12 changed files with 198 additions and 158 deletions
|
|
@ -175,7 +175,7 @@ class TestConstI18nMiddleware:
|
|||
|
||||
|
||||
class TestFSMI18nMiddleware:
|
||||
async def test_middleware(self, i18n: I18n, bot: MockedBot, extra):
|
||||
async def test_middleware(self, i18n: I18n, bot: MockedBot):
|
||||
middleware = FSMI18nMiddleware(i18n=i18n)
|
||||
storage = MemoryStorage()
|
||||
state = FSMContext(storage=storage, key=StorageKey(user_id=42, chat_id=42, bot_id=bot.id))
|
||||
|
|
@ -185,12 +185,14 @@ class TestFSMI18nMiddleware:
|
|||
}
|
||||
result = await middleware(next_call, Update(update_id=42), data)
|
||||
assert result == "test"
|
||||
|
||||
await middleware.set_locale(state, "uk")
|
||||
assert i18n.current_locale == "uk"
|
||||
|
||||
result = await middleware(next_call, Update(update_id=42), data)
|
||||
assert result == "тест"
|
||||
|
||||
async def test_without_state(self, i18n: I18n, bot: MockedBot, extra):
|
||||
async def test_without_state(self, i18n: I18n, bot: MockedBot):
|
||||
middleware = FSMI18nMiddleware(i18n=i18n)
|
||||
data = {
|
||||
"event_from_user": User(id=42, is_bot=False, language_code="it", first_name="Test"),
|
||||
|
|
@ -198,7 +200,3 @@ class TestFSMI18nMiddleware:
|
|||
result = await middleware(next_call, Update(update_id=42), data)
|
||||
assert i18n.current_locale == "en"
|
||||
assert result == "test"
|
||||
|
||||
assert i18n.current_locale == "en"
|
||||
result = await middleware(next_call, Update(update_id=42), data)
|
||||
assert i18n.current_locale == "en"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue