diff --git a/tests/test_bot.py b/tests/test_bot.py index c8fb6472..8799cafe 100644 --- a/tests/test_bot.py +++ b/tests/test_bot.py @@ -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 diff --git a/tests/types/dataset.py b/tests/types/dataset.py index d2a5eecd..87f49620 100644 --- a/tests/types/dataset.py +++ b/tests/types/dataset.py @@ -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 = {}