<commit_before>import sys, os
sys.path.append(os.path.realpath(os.path.dirname(__file__)+"/.."))
from pymessenger.bot import Bot as PyBot
from pymessenger import Element

TOKEN = os.environ.get('TOKEN')
bot = PyBot(TOKEN)
recipient_id = os.environ.get('RECIPIENT_ID')

def test_wrong_format_message():
    result = bot.send_text_message(recipient_id, {'text': "its a test"})
    assert type(result) is dict
    assert result.get('message_id') is None

def test_text_message():
    result = bot.send_text_message(recipient_id, "test")
    assert type(result) is dict
    assert result.get('message_id') is not None
    assert result.get('recipient_id') is not None<commit_msg>add test for elements message<commit_after>import sys, os
sys.path.append(os.path.realpath(os.path.dirname(__file__)+"/.."))

from pymessenger.bot import Bot as PyBot
from pymessenger import Element

TOKEN = os.environ.get('TOKEN')
APP_SECRET = os.environ.get('APP_SECRET')

bot = PyBot(TOKEN, app_secret=APP_SECRET)
recipient_id = os.environ.get('RECIPIENT_ID')

def test_wrong_format_message():
    result = bot.send_text_message(recipient_id, {'text': "its a test"})
    assert type(result) is dict
    assert result.get('message_id') is None

def test_text_message():
    result = bot.send_text_message(recipient_id, "test")
    assert type(result) is dict
    assert result.get('message_id') is not None
    assert result.get('recipient_id') is not None

def test_elements():
    image_url = 'https://lh4.googleusercontent.com/-dZ2LhrpNpxs/AAAAAAAAAAI/AAAAAAAA1os/qrf-VeTVJrg/s0-c-k-no-ns/photo.jpg'
    elements = []
    element = Element(title="Arsenal", image_url=image_url, subtitle="Click to go to Arsenal website.", item_url="http://arsenal.com")
    elements.append(element)
    result = bot.send_generic_message(recipient_id, elements)
    assert type(result) is dict
    assert result.get('message_id') is not None
    assert result.get('recipient_id') is not None
{'fraction_non_alphanumeric': 0.12544802867383512, 'fraction_numerical': 0.002048131080389145, 'mean_word_length': 4.9755351681957185, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3669831', 'n_tokens_mistral': 677, 'n_tokens_neox': 670, 'n_words': 149}