docstr: Check if the test event contains the required keys
  
  Returns:
      bool: True if the proper keys are present
docstr_tok: ["Check","if","the","test","event","contains","the","required","keys","Returns",":","bool",":","True","if","the","proper","keys","are","present"]
code: def is_valid(self, config):
      """Check if the test event contains the required keys
  
      Returns:
          bool: True if the proper keys are present
      """
      if not isinstance(self._event, dict):
          self.error = (
              "Invalid type for event: {}; should be dict".format(
                  type(self._event)
              )
          )
          return False
  
      test_event_keys = set(self._event)
      if not self.REQUIRED_KEYS.issubset(test_event_keys):
          req_key_diff = self.REQUIRED_KEYS.difference(test_event_keys)
          missing_keys = ", ".join(
              "'{}'".format(key) for key in req_key_diff
          )
          self.error = (
              "Missing required key(s) in test event: {}".format(
                  missing_keys
              )
          )
          return False
  
      if not (self.data or self.override_record):
          self.error = "Test event must contain either 'data' or 'override_record'"
          return False
  
      if not self._event.get("classify_only"):
          if "trigger_rules" not in test_event_keys:
              self.error = (
                  "Test events that are not 'classify_only' should have 'trigger_rules' "
                  "defined"
              )
              return False
  
      if self.log not in config["logs"]:
          self.error = (
              "No defined schema in config for log type: {}".format(
                  self.log
              )
          )
          return False
  
      # Log a warning if there are extra keys declared in the test log, but this is not an error
      key_diff = test_event_keys.difference(
          self.REQUIRED_KEYS
          | self.OPTIONAL_KEYS
          | self.ACCEPTABLE_DATA_KEYS
      )
  
      if key_diff:
          extra_keys = ", ".join("'{}'".format(key) for key in key_diff)
          LOGGER.warning(
              "Additional unnecessary keys in test event: %s",
              extra_keys,
          )
  
      return True
  
imports: import base64
  import json
  import re
  import time
  import zlib
  from mock import patch
  from streamalert.classifier.parsers import ParserBase
  from streamalert.shared import rule
  from streamalert.shared.logger import get_logger
  from streamalert_cli.test.mocks import LookupTableMocks, ThreatIntelMocks
label_desc: Use image node_id 18 for calling the TestEvent obj's underlying member method code with example usage: obj.is_valid(config) and returns: True, False, False, False, False, False