예제 #1
0
 def testHashFile(self):
     """Tests that results are produced correctly."""
     analyzer = hashing_analyzer.HashingAnalyzer()
     analyzer.SetHasherNames('testhash')
     analyzer.Analyze('test data')
     results = analyzer.GetResults()
     first_result = results[0]
     self.assertIsInstance(first_result, analyzer_result.AnalyzerResult)
     self.assertEqual(first_result.analyzer_name, 'hashing')
     self.assertEqual(first_result.attribute_name, 'testhash_hash')
     self.assertEqual(first_result.attribute_value, '4')
     self.assertEqual(len(results), 1)
예제 #2
0
 def testHasherInitialization(self):
     """Test the creation of the analyzer, and the enabling of hashers."""
     analyzer = hashing_analyzer.HashingAnalyzer()
     analyzer.SetHasherNames('testhash')
     self.assertEqual(len(analyzer._hashers), 1)