def Init(self, name, artifact, handler_class, result_context): """Helper method to verify that the Probe sets up the right handler.""" cfg = self.configs.get(name) probe = checks.Probe(**cfg) self.assertEqual(artifact, probe.artifact) self.assertIsInstance(probe.handler, handler_class) self.assertIsInstance(probe.matcher, checks.Matcher) self.assertItemsEqual(result_context, str(probe.result_context))
def GetFilters(self, filt_defs): """Initialize one or more filters as if they were contained in a probe.""" # The artifact isn't actually used for anything, it's just required to # initialize handlers. probe = checks.Probe(artifact="Data", filters=filt_defs) return probe.filters