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)
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)