Beispiel #1
0
 def test_config_write_with_none(self):
     _filename = os.path.join(os.path.dirname(__file__),
                              'testing_config')
     config._file = _filename
     config.save()
     self.assertTrue(os.path.exists(_filename))
     os.remove(_filename)
 def do_save(self, args):
     argstrs = args.split()
     try:
         if len(argstrs) > 0:
             config.save(argstrs[0])
         else:
             config.save()
         print ("Config saved.")
     except Exception as e:
         self.error(e)
Beispiel #3
0
 def do_save(self, args):
     argstrs = args.split()
     try:
         if len(argstrs) > 0:
             config.save(argstrs[0])
         else:
             config.save()
         print "Config saved."
     except Exception, e:
         self.error(e)
Beispiel #4
0
 def test_load_conf(self):
     self.assertRaises(config.ConfigException, config.load, 'NoSuchFile')
     # Everything should be ok
     config.save('TestConfig.ini')
     config.load('TestConfig.ini')
     # let's corrupt the file
     cfg = open('TestConfig.ini', 'w')
     cfg.write('Corruption')
     cfg.close()
     self.assertRaises(config.ConfigException, config.load,
                       'TestConfig.ini')
     os.remove('TestConfig.ini')