mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
feat: add UserFactory
This commit is contained in:
parent
6f53f15577
commit
e0baed8eee
14 changed files with 136 additions and 65 deletions
|
|
@ -1,7 +1,8 @@
|
|||
import pytest
|
||||
|
||||
from aiogram.api.methods import GetChatMember, Request
|
||||
from aiogram.api.types import ChatMember, User
|
||||
from aiogram.api.types import ChatMember
|
||||
from tests.factories.user import UserFactory
|
||||
from tests.mocked_bot import MockedBot
|
||||
|
||||
|
||||
|
|
@ -9,9 +10,7 @@ class TestGetChatMember:
|
|||
@pytest.mark.asyncio
|
||||
async def test_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(
|
||||
GetChatMember,
|
||||
ok=True,
|
||||
result=ChatMember(user=User(id=42, is_bot=False, first_name="User"), status="creator"),
|
||||
GetChatMember, ok=True, result=ChatMember(user=UserFactory(), status="creator"),
|
||||
)
|
||||
|
||||
response: ChatMember = await GetChatMember(chat_id=-42, user_id=42)
|
||||
|
|
@ -22,9 +21,7 @@ class TestGetChatMember:
|
|||
@pytest.mark.asyncio
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(
|
||||
GetChatMember,
|
||||
ok=True,
|
||||
result=ChatMember(user=User(id=42, is_bot=False, first_name="User"), status="creator"),
|
||||
GetChatMember, ok=True, result=ChatMember(user=UserFactory(), status="creator"),
|
||||
)
|
||||
|
||||
response: ChatMember = await bot.get_chat_member(chat_id=-42, user_id=42)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue