def test_imp_scp_local_path(self): # defaults to configuration defaults user_home = os.path.expanduser("~") Configuration().core_clear() rsp = RsParameters() self.assertEquals(user_home, rsp.imp_scp_local_path) # contamination test rsp.imp_scp_local_path = os.path.join(user_home, "local", "rs") rsp2 = RsParameters(**rsp.__dict__) self.assertEquals(os.path.join(user_home, "local", "rs"), rsp2.imp_scp_local_path) rsp.imp_scp_local_path = os.path.join(user_home, "rs", "local") rsp3 = RsParameters(**rsp.__dict__) self.assertEquals(os.path.join(user_home, "rs", "local"), rsp3.imp_scp_local_path) self.save_configuration_test(rsp)
def read_parameters(self): paras = RsParameters(config_name="DEFAULT") # configuration: cfg_file = os.path.join(os.path.expanduser("~"), CFG_FILE) with open(cfg_file) as cfg: line = cfg.readline() spup = line.split(",") paras.imp_scp_server = spup[0] paras.imp_scp_port = int(spup[1]) paras.imp_scp_user = spup[2] password = spup[3] paras.imp_scp_remote_path = spup[4] paras.imp_scp_local_path = spup[5].strip() return paras, password