Fixed tests

This commit is contained in:
Alex Root Junior 2023-07-28 22:16:52 +03:00
parent 599f843268
commit 84d767fdfc
No known key found for this signature in database
GPG key ID: 074C1D455EBEA4AC
5 changed files with 24 additions and 28 deletions

View file

@ -29,15 +29,17 @@ class TestBaseClassBasedHandler:
async def test_bot_from_context(self):
event = Update(update_id=42)
handler = MyHandler(event=event, key=42)
bot = Bot("42:TEST")
with pytest.raises(LookupError):
handler.bot
Bot.set_current(bot)
handler = MyHandler(event=event, key=42, bot=bot)
assert handler.bot == bot
async def test_bot_from_context_missing(self):
event = Update(update_id=42)
handler = MyHandler(event=event, key=42)
with pytest.raises(RuntimeError):
handler.bot
async def test_bot_from_data(self):
event = Update(update_id=42)
bot = Bot("42:TEST")