コード例 #1
0
ファイル: checks_test.py プロジェクト: youngjun-chang/grr
 def testCheckOne(self):
   """ONE operations should return anomalies if there is not one result."""
   matcher = checks.Matcher(["ONE"], self.hint)
   for baseline in self.baselines:
     self.assertIsInstance(
         matcher.Detect(baseline, self.one), checks.CheckResult)
     for result in [self.none, self.some]:
       self.assertFalse(matcher.Detect(baseline, result))
コード例 #2
0
ファイル: checks_test.py プロジェクト: youngjun-chang/grr
 def testCheckNone(self):
   """NONE returns an anomaly if there are no results."""
   matcher = checks.Matcher(["NONE"], self.hint)
   for baseline in self.baselines:
     self.assertIsInstance(
         matcher.Detect(baseline, self.none), checks.CheckResult)
     for result in [self.one, self.some]:
       self.assertFalse(matcher.Detect(baseline, result))
コード例 #3
0
ファイル: checks_test.py プロジェクト: youngjun-chang/grr
 def testMultipleMatch(self):
   """Checks with multiple match methods emit results if any methods fire."""
   matcher = checks.Matcher(["NONE", "ONE"], self.hint)
   for baseline in self.baselines:
     for result in [self.none, self.one]:
       self.assertIsInstance(
           matcher.Detect(baseline, result), checks.CheckResult)
     self.assertFalse(matcher.Detect(baseline, self.some))
コード例 #4
0
ファイル: checks_test.py プロジェクト: youngjun-chang/grr
 def testCheckAny(self):
   """ANY operations should not return anomalies if there are results."""
   matcher = checks.Matcher(["ANY"], self.hint)
   for baseline in self.baselines:
     for result in [self.one, self.some]:
       self.assertIsInstance(
           matcher.Detect(baseline, result), checks.CheckResult)
     self.assertFalse(matcher.Detect(baseline, self.none))
コード例 #5
0
ファイル: checks_test.py プロジェクト: youngjun-chang/grr
 def testCheckAll(self):
   """ALL operations return anomalies if input and result counts differ."""
   matcher = checks.Matcher(["ALL"], self.hint)
   will_detect = [(self.one, self.one), (self.some, self.some)]
   not_detect = [(self.none, self.none), (self.some, self.one), (self.some,
                                                                 self.none)]
   will_raise = [(self.none, self.one), (self.one, self.some), (self.none,
                                                                self.some)]
   for base, result in will_detect:
     self.assertIsInstance(matcher.Detect(base, result), checks.CheckResult)
   for base, result in not_detect:
     self.assertFalse(matcher.Detect(base, result))
   for base, result in will_raise:
     self.assertRaises(checks.ProcessingError, matcher.Detect, base, result)