def testCreateConfigFile(self): configFilename = os.path.join("out", "esp.config") datasourceFilename = "ESP6500SI-V2.vcf.gz" dataSourceType = "indexed_vcf" datasourceMatchMode = "avg" dataSourceName = "ESP" dataSourceVersion = "6500SI-V2" datasourceBuilder = TabixIndexedVcfDatasourceCreator() datasourceBuilder._createConfigFile(configFilename=configFilename, baseDSFile=datasourceFilename, ds_type=dataSourceType, ds_name=dataSourceName, ds_version=dataSourceVersion, ds_match_mode=datasourceMatchMode) configParser = ConfigUtils.createConfigParser(configFilename) self.assertTrue(configParser.has_section("general"), "general section is missing.") self.assertTrue(configParser.has_option("general", "type"), "type option is missing in general section.") self.assertTrue(configParser.has_option("general", "src_file"), "src_file option is missing in general section.") self.assertTrue(configParser.has_option("general", "title"), "title option is missing in general section.") self.assertTrue(configParser.has_option("general", "version"), "version option is missing in general section.") self.assertTrue(configParser.has_option("general", "match_mode"), "match_mode option is missing in general section.") self.assertEqual(configParser.get("general", "type"), dataSourceType, "Expected data source type is %s but was %s." % (dataSourceType, configParser.get("general", "type"))) self.assertEqual(configParser.get("general", "src_file"), datasourceFilename, "Expected data source src_file is %s but was %s." % (datasourceFilename, configParser.get("general", "src_file"))) self.assertEqual(configParser.get("general", "title"), dataSourceName, "Expected data source title is %s but was %s." % (dataSourceName, configParser.get("general", "title"))) self.assertEqual(configParser.get("general", "version"), dataSourceVersion, "Expected data source version is %s but was %s." % (dataSourceVersion, configParser.get("general", "version"))) self.assertEqual(configParser.get("general", "match_mode"), datasourceMatchMode, "Expected data source match mode is %s but was %s." % (datasourceMatchMode, configParser.get("general", "match_mode")))