aiogram_unittest
aiogram_unittest is a testing library for bots written on aiogram
📚 Simple examples
Simple handler test
Simple bot:
from aiogram import Bot, Dispatcher, types, executor
# Please, keep your bot tokens on environments, this code only example
bot = Bot('123456789:AABBCCDDEEFFaabbccddeeff-1234567890')
dp = Dispatcher(bot)
@dp.message_handler()
async def echo(message: types.Message):
await message.answer(message.text)
if __name__ == '__main__':
executor.start_polling(dp)
Test cases:
import unittest
from bot import echo
from aiogram_unittest import Requester
from aiogram_unittest.handler import MessageHandler
from aiogram_unittest.types.dataset import MESSAGE
class TestBot(unittest.IsolatedAsyncioTestCase):
async def test_echo(self):
request = Requester(request_handler=MessageHandler(echo))
calls = await request.query(message=MESSAGE.as_object(text="Hello, Bot!"))
answer_message = calls.send_messsage.fetchone()
self.assertEqual(answer_message.text, 'Hello, Bot!')
▶️ More examples
Metadata
Release files for aiogram-unittest 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| aiogram_unittest-0.0.1.tar.gz | 13.6 kB | Without provenance | Details for aiogram_unittest-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aiogram_unittest-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for aiogram_unittest-0.0.1-py3-none-any.whl |
Total release size: 28.2 kB
Release files / aiogram_unittest-0.0.1.tar.gz
| Download URL | aiogram_unittest-0.0.1.tar.gz |
|---|---|
| Size | 13.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d5fa33bf406b60eab26a885e33e55fb7b5aaa64829ed4c95ee9e99a40de7c25e
|
|
BLAKE2b-256 checksum How to use checksums |
b2c1b846ba831676ea537ffd4ee621a1de73996b146883dc7ee605936751131e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.6
|
Release files / aiogram_unittest-0.0.1-py3-none-any.whl
| Download URL | aiogram_unittest-0.0.1-py3-none-any.whl |
|---|---|
| Size | 14.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3267979b1249f6d915c2affe053aecf1b2d631ff057dce9bf0218506426f41e9
|
|
BLAKE2b-256 checksum How to use checksums |
eda720c49ed9a7560958c8a8384d5db448b91d1db27b57f2f999f06b713bcc23
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.6
|
Security for aiogram-unittest 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.