def testFacilityConversion(self): event = self._createDummyEvent() proto = Event() serializer = Serializer(event) event.facility = "1" # fill the protobuf proto = serializer.fill(proto) # should have converted to an int self.assertEqual(proto.syslog_facility, 1) self.assertEqual(proto.event_class_key, event.eventClassKey)
def testFacilityConversion(self): event = self._createDummyEvent() proto = Event() serializer = Serializer(event) event.facility = "1" # fill the protobuf proto = serializer.fill(proto) # should have converted to an int self.assertEqual(proto.syslog_facility, 1) self.assertEqual(proto.event_class_key, event.eventClassKey)
def testAdaptingEventtoProtobuf(self): # setup event and device device = self.device event = self._createDummyEvent() event.foo = "bar" proto = Event() serializer = Serializer(event) # fill the protobuf proto = serializer.fill(proto) # check the results self.assertEqual(proto.agent, event.agent) self.assertEqual(proto.event_key, event.eventKey) # make sure the actor was set self.assertEqual(proto.actor.element_identifier, device.id) # make sure we have at least one detail self.assertTrue(len(proto.details) >= 1) # the new severity value self.assertEqual(proto.severity, 4)
def testAdaptingEventtoProtobuf(self): # setup event and device device = self.device event = self._createDummyEvent() event.foo = "bar" proto = Event() serializer = Serializer(event) # fill the protobuf proto = serializer.fill(proto) # check the results self.assertEqual(proto.agent, event.agent) self.assertEqual(proto.event_key, event.eventKey) # make sure the actor was set self.assertEqual(proto.actor.element_identifier, device.id) # make sure we have at least one detail self.assertTrue(len(proto.details) >= 1) # the new severity value self.assertEqual(proto.severity, 4)