当前位置: 首页>>代码示例>>Python>>正文


Python AVOssimSetupConfigHandler.get_error_list方法代码示例

本文整理汇总了Python中ossimsetupconfig.AVOssimSetupConfigHandler.get_error_list方法的典型用法代码示例。如果您正苦于以下问题:Python AVOssimSetupConfigHandler.get_error_list方法的具体用法?Python AVOssimSetupConfigHandler.get_error_list怎么用?Python AVOssimSetupConfigHandler.get_error_list使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ossimsetupconfig.AVOssimSetupConfigHandler的用法示例。


在下文中一共展示了AVOssimSetupConfigHandler.get_error_list方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_load_config

# 需要导入模块: from ossimsetupconfig import AVOssimSetupConfigHandler [as 别名]
# 或者: from ossimsetupconfig.AVOssimSetupConfigHandler import get_error_list [as 别名]
 def test_load_config(self):
     #1 - File doesn't exists!
     config = AVOssimSetupConfigHandler(TEST_FILES_PATH+"ossim_setup12.conf")
     #load config it's a private function. We can't access to it directly
     self.assertEqual(config.get_general_admin_dns(),None)
     self.assertTrue(config.has_errors())
     error_list =  config.get_error_list()
     self.assertTrue(error_list.has_key("FILE_ERRORS"))
     self.assertTrue(error_list["FILE_ERRORS"].has_key("file"))
     self.assertEqual(error_list["FILE_ERRORS"]["file"][0],2000)
     del config
     #2 - Invalid File - Duplicated section
     config = AVOssimSetupConfigHandler(TEST_FILES_PATH+"ossim_setup4.conf")
     #load config it's a private function. We can't access to it directly
     self.assertEqual(config.get_general_admin_dns(),None)
     self.assertTrue(config.has_errors())
     error_list =  config.get_error_list()
     self.assertTrue(error_list.has_key("FILE_ERRORS"))
     self.assertTrue(error_list["FILE_ERRORS"].has_key("file"))
     self.assertEqual(error_list["FILE_ERRORS"]["file"][0],2001)
     del config
     #3 - Invalid File -(invalid syntax) 
     config = AVOssimSetupConfigHandler(TEST_FILES_PATH+"ossim_setup3.conf")
     #load config it's a private function. We can't access to it directly
     self.assertEqual(config.get_general_admin_dns(),None)
     self.assertTrue(config.has_errors())
     error_list =  config.get_error_list()
     self.assertTrue(error_list.has_key("FILE_ERRORS"))
     self.assertTrue(error_list["FILE_ERRORS"].has_key("file"))
     self.assertEqual(error_list["FILE_ERRORS"]["file"][0],2001)
     del config
     
     #4 - Correct File
     config = AVOssimSetupConfigHandler(TEST_FILES_PATH+"ossim_setup1.conf")
     #load config it's a private function. We can't access to it directly
     #self.assertEqual(config.get_general_admin_dns(),"8.8.8.8")
     error_list =  config.get_error_list()
     print error_list
     self.assertFalse(config.has_errors())
     self.assertEqual(len(error_list),0)
     del config
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:43,代码来源:ossimsetupconfig_tests.py

示例2: test_get_error_list

# 需要导入模块: from ossimsetupconfig import AVOssimSetupConfigHandler [as 别名]
# 或者: from ossimsetupconfig.AVOssimSetupConfigHandler import get_error_list [as 别名]
 def test_get_error_list(self):
     config = AVOssimSetupConfigHandler(TEST_FILES_PATH+"ossim_setup1.conf")
     error_list =  config.get_error_list()
     self.assertEqual(len(error_list),0)
     del config
     
     config = AVOssimSetupConfigHandler(TEST_FILES_PATH+"ossim_setup1222.conf")
     error_list =  config.get_error_list()
     self.assertEqual(len(error_list), 1)
     del config
     
     config = AVOssimSetupConfigHandler(TEST_FILES_PATH+"ossim_setup3.conf")
     error_list =  config.get_error_list()
     self.assertEqual(len(error_list), 1)
     del config
     #this file has two errors_
     #{'firewall': {'active': (3, 'Invalid boolean value, allowed values (1,yes,true,si,on,0,false,off,no)<InvalidVAlue>')}, 'sensor': {'monitors': (1018, 'Invalid monitor plugin! Monitor plugin not found <unknown-plugin>')}}
     config = AVOssimSetupConfigHandler(TEST_FILES_PATH+"ossim_setup5.conf")
     error_list =  config.get_error_list()
     self.assertEqual(len(error_list), 2)
     del config
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:23,代码来源:ossimsetupconfig_get_tests.py

示例3: test_save_ossim_setup_file

# 需要导入模块: from ossimsetupconfig import AVOssimSetupConfigHandler [as 别名]
# 或者: from ossimsetupconfig.AVOssimSetupConfigHandler import get_error_list [as 别名]
 def test_save_ossim_setup_file(self):
     config = AVOssimSetupConfigHandler(TEST_FILES_PATH+"ossim_setup1.conf")
     tmpfile = "/tmp/tmpossimsetup.cfg.%s" %(int(time.time()))
     print config.get_error_list()
     self.assertEqual(config.save_ossim_setup_file(tmpfile),AVConfigParserErrors.ALL_OK)
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:7,代码来源:ossimsetupconfig_tests.py


注:本文中的ossimsetupconfig.AVOssimSetupConfigHandler.get_error_list方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。