def get_values(config_file='config.ini'): # check config file is present or not if not os.path.isfile(config_file): logger.error("config file is missing") raise source_csv = {'csv_file': '', 'fieldnames': ''} for key in source_csv.iterkeys(): source_csv[key] = utils.get_config_value(config_file, 'CSV', key) mapping = {} for field in REDMINE_ISSUE_FIELDS: mapping[field] = utils.get_config_value(config_file, 'CSV', field) source_csv['fieldnames_mapping'] = mapping dest_redmine = {'username': '', 'password': '', 'id': '', 'url': '', 'name': '', 'sf_domain': '', 'versions_to_skip': [], 'issues_to_skip': []} for key in dest_redmine.iterkeys(): dest_redmine[key] = utils.get_config_value(config_file, 'DEST_REDMINE', key) # if url ends with backslash, remove it before use. if dest_redmine['url'].endswith('/'): dest_redmine['url'] = dest_redmine['url'][:-1] versions_to_skip = utils.get_config_value(config_file, 'SKIP', 'version_id') if versions_to_skip: dest_redmine['versions_to_skip'] = versions_to_skip.split(',') issues_to_skip = utils.get_config_value(config_file, 'SKIP', 'issue_id') if issues_to_skip: dest_redmine['issues_to_skip'] = issues_to_skip.split(',') dest_redmine['mapper'] = utils.ConfigMapper('config.ini') return source_csv, dest_redmine
def get_values(config_file='config.ini'): # check config file is present or not if not os.path.isfile(config_file): logger.error("config file is missing") raise source_github = {'username': '', 'password': '', 'repo_owner': '', 'repository': ''} for key in source_github.iterkeys(): source_github[key] = utils.get_config_value(config_file, 'GITHUB', key) dest_redmine = {'username': '', 'password': '', 'id': '', 'url': '', 'name': '', 'sf_domain': '', 'versions_to_skip': [], 'issues_to_skip': []} for key in dest_redmine.iterkeys(): dest_redmine[key] = utils.get_config_value(config_file, 'DEST_REDMINE', key) # if url ends with backslash, remove it before use. if dest_redmine['url'].endswith('/'): dest_redmine['url'] = dest_redmine['url'][:-1] versions_to_skip = utils.get_config_value(config_file, 'SKIP', 'version_id') if versions_to_skip: dest_redmine['versions_to_skip'] = versions_to_skip.split(',') issues_to_skip = utils.get_config_value(config_file, 'SKIP', 'issue_id') if issues_to_skip: dest_redmine['issues_to_skip'] = issues_to_skip.split(',') dest_redmine['mapper'] = utils.ConfigMapper('config.ini') return source_github, dest_redmine
def get_values(config_file='config.ini'): # check config file is present or not if not os.path.isfile(config_file): logger.error("config file is missing") raise source_redmine = {'username': '', 'password': '', 'id': '', 'apikey': '', 'url': '', 'name': ''} for key in source_redmine.iterkeys(): source_redmine[key] = utils.get_config_value(config_file, 'SOURCE_REDMINE', key) dest_redmine = {'username': '', 'password': '', 'id': '', 'url': '', 'name': '', 'sf_domain': '', 'versions_to_skip': [], 'issues_to_skip': []} for key in dest_redmine.iterkeys(): dest_redmine[key] = utils.get_config_value(config_file, 'DEST_REDMINE', key) # if url ends with backslash, remove it before use. if source_redmine['url'].endswith('/'): source_redmine['url'] = source_redmine['url'][:-1] if dest_redmine['url'].endswith('/'): dest_redmine['url'] = dest_redmine['url'][:-1] versions_to_skip = utils.get_config_value(config_file, 'SKIP', 'version_id') if versions_to_skip: dest_redmine['versions_to_skip'] = versions_to_skip.split(',') issues_to_skip = utils.get_config_value(config_file, 'SKIP', 'issue_id') if issues_to_skip: dest_redmine['issues_to_skip'] = issues_to_skip.split(',') dest_redmine['mapper'] = utils.ConfigMapper('config.ini') return source_redmine, dest_redmine
def test_get_config_value(self): self.assertEqual('that', utils.get_config_value(self.conf_file, 'SECTION1', 'this')) self.assertEqual(None, utils.get_config_value(self.conf_file, 'SECTION1', 'that'))
def get_values(config_file='config.ini'): # check config file is present or not if not os.path.isfile(config_file): logger.error("config file is missing") raise source_csv = {'csv_file': '', 'fieldnames': ''} for key in source_csv.iterkeys(): source_csv[key] = utils.get_config_value(config_file, 'CSV', key) mapping = {} for field in REDMINE_ISSUE_FIELDS: mapping[field] = utils.get_config_value(config_file, 'CSV', field) source_csv['fieldnames_mapping'] = mapping dest_redmine = { 'username': '', 'password': '', 'id': '', 'url': '', 'name': '', 'sf_domain': '', 'versions_to_skip': [], 'issues_to_skip': [] } for key in dest_redmine.iterkeys(): dest_redmine[key] = utils.get_config_value(config_file, 'DEST_REDMINE', key) # if url ends with backslash, remove it before use. if dest_redmine['url'].endswith('/'): dest_redmine['url'] = dest_redmine['url'][:-1] versions_to_skip = utils.get_config_value(config_file, 'SKIP', 'version_id') if versions_to_skip: dest_redmine['versions_to_skip'] = versions_to_skip.split(',') issues_to_skip = utils.get_config_value(config_file, 'SKIP', 'issue_id') if issues_to_skip: dest_redmine['issues_to_skip'] = issues_to_skip.split(',') dest_redmine['mapper'] = utils.ConfigMapper('config.ini') return source_csv, dest_redmine
def test_get_config_value(self): self.assertEqual( 'that', utils.get_config_value(self.conf_file, 'SECTION1', 'this')) self.assertEqual( None, utils.get_config_value(self.conf_file, 'SECTION1', 'that'))
def test_get_config_value(self): self.assertEqual("that", utils.get_config_value(self.conf_file, "SECTION1", "this")) self.assertEqual(None, utils.get_config_value(self.conf_file, "SECTION1", "that"))