def testGetEventTaggingRules(self): """Tests the GetEventTaggingRules function.""" test_path = self._GetTestFilePath(['tagging_file', 'valid.txt']) tag_file = tagging_file.TaggingFile(test_path) tag_expression = tag_file.GetEventTaggingRules() self.assertEqual(len(tag_expression.children), 5) test_path = self._GetTestFilePath( ['tagging_file', 'invalid_syntax.txt']) tag_file = tagging_file.TaggingFile(test_path) with self.assertRaises(errors.TaggingFileError): tag_file.GetEventTaggingRules()
def testGetEventTaggingRulesInvalidSyntax(self): """Tests the GetEventTaggingRules function on a file with invalid syntax.""" test_path = self._GetTestFilePath(['tagging_file', 'invalid_syntax.txt']) tag_file = tagging_file.TaggingFile(test_path) with self.assertRaises(errors.TaggingFileError): tag_file.GetEventTaggingRules()
def testGetEventTaggingRules(self): """Tests the GetEventTaggingRules function.""" test_path = self._GetTestFilePath(['tagging_file', 'valid.txt']) tag_file = tagging_file.TaggingFile(test_path) tagging_rules = tag_file.GetEventTaggingRules() self.assertEqual(len(tagging_rules), 5)
def SetAndLoadTagFile(self, tagging_file_path): """Sets the tag file to be used by the plugin. Args: tagging_file_path (str): path of the tagging file. """ tag_file = tagging_file.TaggingFile(tagging_file_path) self._tagging_rules = tag_file.GetEventTaggingRules()