def testInitChangeConfigs(self): conf = cpc.util.conf.conf.Conf(self.confFile, self.confDir) self.assertEquals(conf.get('global_dir'), os.path.join(os.environ["HOME"], ".copernicus")) self.assertEquals(conf.get('conf_dir'), self.confDir) testValue = 'testvalue' confParam = 'test_conf' conf._add(confParam, testValue, "a test configuration parameter", True) clientHostIp = '127.0.0.10' conf.set(confParam, clientHostIp) self.assertEquals(conf.get('conf_file'), self.confFile) self.assertTrue(os.path.isfile(conf.getFile('conf_file'))) self.assertEquals(conf.get(confParam), clientHostIp) #read the file, do json_decode, ensure that the conf param exists f = open(conf.getFile('conf_file')) str = f.read() confs = json.loads(str) self.assertEquals(confs[confParam], clientHostIp)
def testInitChangeConfigs(self): conf = cpc.util.conf.conf.Conf(self.confFile,self.confDir) self.assertEquals(conf.get('global_dir'),os.path.join(os.environ["HOME"], ".copernicus")) self.assertEquals(conf.get('conf_dir'), self.confDir) testValue = 'testvalue' confParam = 'test_conf' conf._add(confParam, testValue, "a test configuration parameter", True) clientHostIp = '127.0.0.10' conf.set(confParam,clientHostIp) self.assertEquals(conf.get('conf_file'), self.confFile) self.assertTrue(os.path.isfile(conf.getFile('conf_file'))) self.assertEquals(conf.get(confParam),clientHostIp) #read the file, do json_decode, ensure that the conf param exists f = open(conf.getFile('conf_file')) str = f.read() confs = json.loads(str) self.assertEquals(confs[confParam],clientHostIp)
def testInit(self): conf = cpc.util.conf.conf.Conf() #should have a config filewith default values self.assertEquals(conf.get('hostname'),gethostname()) self.assertEquals(conf.get('global_dir'),os.path.join(os.environ["HOME"], ".copernicus")) self.assertEquals(conf.get('conf_dir'), os.path.join(os.environ["HOME"], ".copernicus",gethostname())) self.assertEquals(conf.get('conf_file'),'cpc.conf')
def testInit(self): conf = cpc.util.conf.conf.Conf() #should have a config filewith default values self.assertEquals(conf.get('hostname'), gethostname()) self.assertEquals(conf.get('global_dir'), os.path.join(os.environ["HOME"], ".copernicus")) self.assertEquals( conf.get('conf_dir'), os.path.join(os.environ["HOME"], ".copernicus", gethostname())) self.assertEquals(conf.get('conf_file'), 'cpc.conf')