docstr: Runs all publishers and compares their results to the suite of configured publisher tests.
  
  Args:
      event (TestEvent): The integration test
docstr_tok: ["Runs","all","publishers","and","compares","their","results","to","the","suite","of","configured","publisher","tests",".","Args",":","event","(","TestEvent",")",":","The","integration","test"]
code: def run_publisher_tests(self, event):
      """
      Runs all publishers and compares their results to the suite of configured publisher tests.
  
      Args:
          event (TestEvent): The integration test
      """
      for alert in event.alerts:
          publication_results = self._run_publishers(alert)
  
          publisher_test_results = []
          for output, individual_tests in event.publisher_tests.items():
              for publisher_test in individual_tests:
                  if isinstance(publisher_test, list):
                      if len(publisher_test) != 3:
                          publisher_test_results.append(
                              {
                                  "success": False,
                                  "error": (
                                      "Invalid publisher test specified: {}"
                                      "Publisher test must be a triple with elements: "
                                      "(jsonpath, condition, condition_value)"
                                  ).format(publisher_test),
                                  "output_descriptor": output,
                              }
                          )
                          continue
  
                      (
                          jsonpath,
                          condition,
                          condition_value,
                      ) = publisher_test
                  elif isinstance(publisher_test, dict):
                      valid_test_syntax = (
                          "jmespath_expression" in publisher_test
                          and "condition" in publisher_test
                          and "value" in publisher_test
                      )
                      if not valid_test_syntax:
                          publisher_test_results.append(
                              {
                                  "success": False,
                                  "error": (
                                      "Invalid publisher test specified: {}"
                                      "Publisher test must be a dict with keys: "
                                      "(jmespath_expression, condition, value)"
                                  ).format(publisher_test),
                                  "output_descriptor": output,
                              }
                          )
                          continue
  
                      jsonpath = publisher_test["jmespath_expression"]
                      condition = publisher_test["condition"]
                      condition_value = publisher_test["value"]
                  else:
                      publisher_test_results.append(
                          {
                              "success": False,
                              "error": (
                                  "Invalid publisher test specified: {}"
                                  "Publisher test must be list or dict"
                              ),
                              "output_descriptor": output,
                          }
                      )
                      continue
  
                  if output not in publication_results:
                      publisher_test_results.append(
                          {
                              "success": False,
                              "error": (
                                  "No such output {} was configured for this alert"
                              ).format(output),
                              "output_descriptor": output,
                          }
                      )
                      continue
  
                  publication = publication_results[output][
                      "publication"
                  ]
  
                  subject_value = jmespath.search(jsonpath, publication)
  
                  conditional = self.PUBLISHER_CONDITIONALS.get(
                      condition, None
                  )
  
                  if not conditional:
                      publisher_test_results.append(
                          {
                              "success": False,
                              "error": (
                                  "Invalid condition specified: {}\n"
                                  "Valid conditions are: {}"
                              ).format(
                                  condition,
                                  list(
                                      self.PUBLISHER_CONDITIONALS.keys()
                                  ),
                              ),
                              "output_descriptor": output,
                          }
                      )
                      continue
  
                  res = conditional["comparator"](
                      subject_value, condition_value
                  )
  
                  publisher_test_results.append(
                      {
                          "success": res,
                          "failure": None
                          if res
                          else (
                              'Item at path "{}" {} "{}",\nActual value: "{}"'.format(
                                  jsonpath,
                                  conditional["clause"],
                                  condition_value,
                                  subject_value,
                              )
                          ),
                          "output_descriptor": output,
                      }
                  )
  
          event.set_publication_results(publisher_test_results)
  
imports: import argparse
  import os
  import jmespath
  from mock import patch, MagicMock
  from streamalert.alert_processor import main
  from streamalert.alert_processor.helpers import compose_alert
  from streamalert.alert_processor.outputs.output_base import OutputDispatcher
  from streamalert.classifier import classifier
  from streamalert.rules_engine import rules_engine
  from streamalert.shared import rule
  from streamalert.shared.config import ConfigError
  from streamalert.shared.logger import get_logger
  from streamalert.shared.stats import RuleStatisticTracker
  from streamalert_cli.helpers import check_credentials
  from streamalert_cli.test.format import format_green, format_red, format_underline, format_yellow
  from streamalert_cli.test.mocks import LookupTableMocks, ThreatIntelMocks
  from streamalert_cli.test.event_file import TestEventFile
  from streamalert_cli.utils import CLICommand, DirectoryType, generate_subparser, UniqueSortedFileListAction, UniqueSortedListAction
label_desc: Use image node_id 1 for calling the PublisherTestRunner obj's underlying member method code with example usage: obj.run_publisher_tests(event) without return types