def _ReadBooleanHelpers(self, formatter, boolean_helpers_definition_values): """Reads boolean helper definitions from a list. Args: formatter (EventFormatter): an event formatter. boolean_helpers_definition_values (list[dict[str, object]]): boolean helpers definition values. Raises: ParseError: if the format of the boolean helper definitions are incorrect. """ for boolean_helper in boolean_helpers_definition_values: input_attribute = boolean_helper.get('input_attribute', None) if not input_attribute: raise errors.ParseError( 'Invalid boolean helper missing input attribute.') output_attribute = boolean_helper.get('output_attribute', None) if not output_attribute: raise errors.ParseError( 'Invalid boolean helper missing output attribute.') value_if_false = boolean_helper.get('value_if_false', None) value_if_true = boolean_helper.get('value_if_true', None) helper = interface.BooleanEventFormatterHelper( input_attribute=input_attribute, output_attribute=output_attribute, value_if_false=value_if_false, value_if_true=value_if_true) formatter.AddHelper(helper)
def testFormatEventValues(self): """Tests the FormatEventValues function.""" event_formatter_helper = interface.BooleanEventFormatterHelper() event_values = {} event_formatter_helper.FormatEventValues(event_values)
def testInitialization(self): """Tests the initialization.""" event_formatter_helper = interface.BooleanEventFormatterHelper() self.assertIsNotNone(event_formatter_helper)