Added tests

This commit is contained in:
Alex Root Junior 2023-07-09 19:45:28 +03:00
parent 08b263dec3
commit b02a1bb2a1
No known key found for this signature in database
GPG key ID: 074C1D455EBEA4AC
4 changed files with 53 additions and 2 deletions

View file

@ -22,6 +22,14 @@ class TestTelegramMethodRemoveUnset:
class TestTelegramMethodCall:
async def test_async_emit_unsuccessful(self, bot: MockedBot):
with pytest.raises(
RuntimeError,
match="This method is not mounted to a any bot instance.+",
):
await GetMe()
async def test_async_emit(self, bot: MockedBot):
bot.add_result_for(GetMe, ok=True, result=User(id=42, is_bot=True, first_name="Test"))
assert isinstance(await GetMe(), User)
method = GetMe().as_(bot)
assert isinstance(await method, User)