feat: add UserFactory

This commit is contained in:
Egor 2020-07-03 13:41:47 +05:00
parent 6f53f15577
commit e0baed8eee
14 changed files with 136 additions and 65 deletions

View file

@ -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)