original_docstring: Check if the test event contains the required keys
  
          Args:
              test_event (dict): The loaded test event from json
  
          Returns:
              bool: True if the proper keys are present
          
docstring: Check if the test event contains the required keys
docstring_tokens: Check if the test event contains the required keys
code: def check_keys(self, test_event):
          """Check if the test event contains the required keys
  
          Args:
              test_event (dict): The loaded test event from json
  
          Returns:
              bool: True if the proper keys are present
          """
          required_keys = {'description', 'log', 'service', 'source', 'trigger_rules'}
  
          record_keys = set(test_event)
          if not required_keys.issubset(record_keys):
              req_key_diff = required_keys.difference(record_keys)
              missing_keys = ', '.join('\'{}\''.format(key) for key in req_key_diff)
              message = 'Missing required key(s) in log: {}'.format(missing_keys)
              self.status_messages.append(StatusMessage(StatusMessage.FAILURE, message))
              return False
  
          input_data_keys = {'data', 'override_record'}
          if not record_keys & input_data_keys:
              missing_keys = ', '.join('\'{}\''.format(key) for key in input_data_keys)
              message = 'Missing one of the following keys in log: {}'.format(missing_keys)
              self.status_messages.append(StatusMessage(StatusMessage.FAILURE, message))
              return False
  
          optional_keys = {'compress', 'validate_schema_only'}
  
          key_diff = record_keys.difference(required_keys | optional_keys | input_data_keys)
  
          # Log a warning if there are extra keys declared in the test log
          if key_diff:
              extra_keys = ', '.join('\'{}\''.format(key) for key in key_diff)
              message = 'Additional unnecessary keys in log: {}'.format(extra_keys)
              # Remove the key(s) and just warn the user that they are extra
              record_keys.difference_update(key_diff)
              self.status_messages.append(StatusMessage(StatusMessage.WARNING, message))
  
          return record_keys.issubset(required_keys | optional_keys | input_data_keys)
code_tokens: def check_keys ( self , test_event ) : required_keys = { 'description' , 'log' , 'service' , 'source' , 'trigger_rules' } record_keys = set ( test_event ) if not required_keys . issubset ( record_keys ) : req_key_diff = required_keys . difference ( record_keys ) missing_keys = ', ' . join ( '\'{}\'' . format ( key ) for key in req_key_diff ) message = 'Missing required key(s) in log: {}' . format ( missing_keys ) self . status_messages . append ( StatusMessage ( StatusMessage . FAILURE , message ) ) return False input_data_keys = { 'data' , 'override_record' } if not record_keys & input_data_keys : missing_keys = ', ' . join ( '\'{}\'' . format ( key ) for key in input_data_keys ) message = 'Missing one of the following keys in log: {}' . format ( missing_keys ) self . status_messages . append ( StatusMessage ( StatusMessage . FAILURE , message ) ) return False optional_keys = { 'compress' , 'validate_schema_only' } key_diff = record_keys . difference ( required_keys | optional_keys | input_data_keys ) if key_diff : extra_keys = ', ' . join ( '\'{}\'' . format ( key ) for key in key_diff ) message = 'Additional unnecessary keys in log: {}' . format ( extra_keys ) record_keys . difference_update ( key_diff ) self . status_messages . append ( StatusMessage ( StatusMessage . WARNING , message ) ) return record_keys . issubset ( required_keys | optional_keys | input_data_keys )
short_docstring: Check if the test event contains the required keys
short_docstring_tokens: Check if the test event contains the required keys
comment: """Check if the test event contains the required keys
  
          Args:
              test_event (dict): The loaded test event from json
  
          Returns:
              bool: True if the proper keys are present
          """$SEP$# Log a warning if there are extra keys declared in the test log$SEP$# Remove the key(s) and just warn the user that they are extra