mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-08 17:13:56 +00:00
Add sendContact test
This commit is contained in:
parent
486978abe4
commit
3e77aa2775
2 changed files with 26 additions and 1 deletions
|
|
@ -234,3 +234,16 @@ async def test_send_venue(bot: Bot, event_loop):
|
|||
title=venue.title, address=venue.address, foursquare_id=venue.foursquare_id,
|
||||
disable_notification=False)
|
||||
assert result == msg
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_send_contact(bot: Bot, event_loop):
|
||||
""" sendContact method test """
|
||||
from .types.dataset import MESSAGE_WITH_CONTACT, CONTACT
|
||||
msg = types.Message(**MESSAGE_WITH_CONTACT)
|
||||
contact = types.Contact(**CONTACT)
|
||||
|
||||
async with FakeTelegram(message_dict=MESSAGE_WITH_CONTACT, loop=event_loop):
|
||||
result = await bot.send_contact(msg.chat.id, phone_number=contact.phone_number, first_name=contact.first_name,
|
||||
last_name=contact.last_name, disable_notification=False)
|
||||
assert result == msg
|
||||
|
|
|
|||
|
|
@ -35,6 +35,12 @@ AUDIO = {
|
|||
"file_size": 9507774
|
||||
}
|
||||
|
||||
CONTACT = {
|
||||
"phone_number": "88005553535",
|
||||
"first_name": "John",
|
||||
"last_name": "Smith",
|
||||
}
|
||||
|
||||
DOCUMENT = {
|
||||
"file_name": "test.docx",
|
||||
"mime_type": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
||||
|
|
@ -227,7 +233,13 @@ MESSAGE_WITH_AUTHOR_SIGNATURE = {}
|
|||
|
||||
MESSAGE_WITH_CHANNEL_CHAT_CREATED = {}
|
||||
|
||||
MESSAGE_WITH_CONTACT = {}
|
||||
MESSAGE_WITH_CONTACT = {
|
||||
"message_id": 56006,
|
||||
"from": USER,
|
||||
"chat": CHAT,
|
||||
"date": 1522850298,
|
||||
"contact": CONTACT
|
||||
}
|
||||
|
||||
MESSAGE_WITH_DELETE_CHAT_PHOTO = {}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue