Ejemplo n.º 1
0
def test_get_messages():

    test_add_message()
    mlist = mailinglist.find_list(list_name)
    dbmessage = Message.objects.filter(mlist=mlist).all()[0]
    key = str(dbmessage.id)
    messages = archive.get_messages([key])
    assert len(messages) == 1
    rmessage = archive.get_message(key)
    assert json.dumps(rmessage, sort_keys=True) == archive.to_json(message.base)
Ejemplo n.º 2
0
def test_add_message():

    """
    Adds a message to the archive.
    """

    dbmessage = archive.store_message(list_name, message)

    assert dbmessage.subject == message['Subject']
    assert json.dumps(archive.get_message(str(dbmessage.id)), sort_keys=True) == archive.to_json(message.base)