Ejemplo n.º 1
0
 def test_add_required_fields(self):
     params = {
         'receivedtimestamp': '2017-09-14T20:05:20.779595+00:00',
         'utctimestamp': '2017-09-14T20:05:20.299387+00:00',
         'timestamp': '2017-09-14T20:05:19.116195+00:00',
         'mozdefhostname': 'randomhostname',
         'category': 'Authentication',
         'hostname': 'host.domain.com',
         'processid': 12345,
         'processname': '/bin/testproc',
         'severity': 'HIGH',
         'source': '/var/log/syslog/mozdef.log',
         'summary': 'example summary',
         'tags': ['example'],
         'details': {
             'firstkey': 'firstvalue',
         }
     }
     event = Event(params)
     event.add_required_fields()
     assert event['receivedtimestamp'] == '2017-09-14T20:05:20.779595+00:00'
     assert event['utctimestamp'] == '2017-09-14T20:05:20.299387+00:00'
     assert event['timestamp'] == '2017-09-14T20:05:19.116195+00:00'
     assert event['mozdefhostname'] == 'randomhostname'
     assert event['category'] == 'Authentication'
     assert event['hostname'] == 'host.domain.com'
     assert event['processid'] == 12345
     assert event['processname'] == '/bin/testproc'
     assert event['severity'] == 'HIGH'
     assert event['source'] == '/var/log/syslog/mozdef.log'
     assert event['summary'] == 'example summary'
     assert event['tags'] == ['example']
     assert event['details'] == {'firstkey': 'firstvalue'}
Ejemplo n.º 2
0
 def test_basic_init(self):
     event = Event()
     assert type(event) is Event
Ejemplo n.º 3
0
 def setup(self):
     self.params = {
         'summary': 'example summary',
         'somefield': 'HIGH',
     }
     self.event = Event(self.params)