Пример #1
0
def test_message_data(saved=True):
    e = MessageData(data='abc', hash_id='abc')
    if saved:
        e.store()
        with get_connection(None) as conn:
            data = conn.execute(
                'SELECT data from message_data WHERE hash = "abc"').fetchone()[0]
        assert data == 'abc'
    return e
Пример #2
0
 def _process_message(self, message):
     message['event'] = 'new-message'
     message_keys = ('stamp', 'topic', 'actor', 'phase', 'hostname',
                     'context', 'msg_type')
     audit_keys = ('event', 'stamp', 'data', 'actor', 'phase', 'hostname',
                   'context')
     message['msg_type'] = message.pop('type')
     payload = message.pop('message')
     msg = Message(**dict(((k, message[k]) for k in message_keys
                           if k in message)))
     audit = Audit(**dict(((k, message[k]) for k in audit_keys
                           if k in message)))
     audit.message = msg
     audit.message.data = MessageData(data=payload['data'],
                                      hash_id=payload['hash'])
     audit.store()
     return message