mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
fix: replace direct creation of Chat instances with usage of ChatFactory
This commit is contained in:
parent
23c0ed633f
commit
d04e220fbb
5 changed files with 15 additions and 14 deletions
|
|
@ -4,6 +4,7 @@ import pytest
|
|||
|
||||
from aiogram.api.methods import GetChatAdministrators, Request
|
||||
from aiogram.api.types import ChatMember, User
|
||||
from tests.factories.user import UserFactory
|
||||
from tests.mocked_bot import MockedBot
|
||||
|
||||
|
||||
|
|
@ -14,7 +15,7 @@ class TestGetChatAdministrators:
|
|||
GetChatAdministrators,
|
||||
ok=True,
|
||||
result=[
|
||||
ChatMember(user=User(id=42, is_bot=False, first_name="User"), status="creator")
|
||||
ChatMember(status="creator")
|
||||
],
|
||||
)
|
||||
|
||||
|
|
@ -29,7 +30,7 @@ class TestGetChatAdministrators:
|
|||
GetChatAdministrators,
|
||||
ok=True,
|
||||
result=[
|
||||
ChatMember(user=User(id=42, is_bot=False, first_name="User"), status="creator")
|
||||
ChatMember(status="creator")
|
||||
],
|
||||
)
|
||||
response: List[ChatMember] = await bot.get_chat_administrators(chat_id=-42)
|
||||
|
|
|
|||
|
|
@ -10,7 +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=UserFactory(), status="creator"),
|
||||
GetChatMember, ok=True, result=ChatMember(status="creator"),
|
||||
)
|
||||
|
||||
response: ChatMember = await GetChatMember(chat_id=-42, user_id=42)
|
||||
|
|
@ -21,7 +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=UserFactory(), status="creator"),
|
||||
GetChatMember, ok=True, result=ChatMember(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