Exemplo n.º 1
0
def test_save_msg(msg='hahah', tag='test tag', talker='admin',
                  expiry=None, time=None, force_create=True):
    """test save a message"""
    interface = DataTransfer(Database(PATH))
    msg = MsgWithTag(msg, tag, talker, expiry, time)
    interface.save_msg(msg, force_create=force_create)
    assert interface.get_msg_by_id(1) is not None
Exemplo n.º 2
0
def init_data():
    """create tag_controller"""
    for path in [PATH, CONFIG]:
        try:
            os.remove(path)
        except FileNotFoundError:
            pass
    interface = DataTransfer(Database(PATH, CONFIG))
    for quoted, tag, in MSG_CONTENTS:
        msg = MsgWithTag(quoted, tag, 'me')  # talker is not important here
        interface.save_msg(msg)
    return interface