示例#1
0
 def roTroNo(self):
     if getattr(self.args, 'fromfile'):
         conf = config.ConfigFile(self.args.switch)
         tests = audit.TestFile()
         tests.load(TEST_TEMPLATE)
         
         auditor = audit.AuditTests(config=conf, tests=tests,
                                             test_group=self.args.testGroup)
         auditor.run()
         for test in auditor.last_results:
             result = 'OK' if test.result else 'FAIL'
             print('%s: %s' % (test.name, result))
示例#2
0
 def test_load_sets_contents(self):
   file_name = 'someFile'
   config_file = config.ConfigFile(file_name)
   self.assertEquals(config_file.contents, C.SAMPLE_CONFIG)
示例#3
0
 def test_init_file_name_calls_load(self, mock_config_file_load):
   file_name = 'someFile'
   config.ConfigFile(file_name)
   mock_config_file_load.called_once_with(file_name)
示例#4
0
 def test_load_opens_file_specified(self, mock_config_file_open):
   file_name = 'someFile'
   config.ConfigFile(file_name)
   mock_config_file_open.assert_called_with(file_name)
示例#5
0
 def test_from_string_sets_contents(self):
   myconf = config.ConfigFile().from_string(C.SAMPLE_CONFIG)
   self.assertEquals(myconf.contents, C.SAMPLE_CONFIG)