move tests to root directory

This commit is contained in:
2022-08-15 21:43:07 +03:00
parent 09b7e58bcd
commit aeb45c9d7d
11 changed files with 19 additions and 20 deletions

33
tests/bot/test_bot.py Normal file
View File

@@ -0,0 +1,33 @@
import pytest
from aiogram import Bot, types
from aiogram.dispatcher.filters.builtin import Command
from app.core.bot import dispatcher
from tests.conftest import FakeTelegram
from tests.data.factories import UserFactory
pytestmark = [
pytest.mark.asyncio,
]
async def test_parse_site(bot: Bot) -> None:
tg_user = UserFactory().as_dict()
user = types.User(**tg_user)
async with FakeTelegram(message_data=tg_user):
result = await bot.me
assert result == user
async def test_command1(bot: Bot) -> None:
dispatcher.bot = bot
handlers = dispatcher.message_handlers.handlers
for handler in handlers:
handl = list(
filter(lambda obj: isinstance(obj.filter, Command), handler.filters)
)
if handl:
command = handl[0].filter.commands[0]
assert command