def __init__(self, *args, **kargs): super(ZanataInit, self).__init__(*args, **kargs) self.config = ZanataConfig() self.mode = 'default' self.remote_config, self.local_config, \ self.command_dict = [{} for i in range(3)] self.command_dict.update(**self.context_data) self.zanata_cmd = None
class ConfigTest(unittest.TestCase): def setUp(self): self.config = ZanataConfig() def test_user_config(self): self.config.set_userconfig("./testfiles/zanata.ini") server = self.config.get_server("http://localhost:8080/zanata") user_name = self.config.get_config_value("username", 'servers', server) apikey = self.config.get_config_value("key", 'servers', server) servers = self.config.get_servers() self.assertTrue('http://localhost:8080/zanata' in servers) self.assertEqual(server, "local") self.assertEqual(user_name, "username") self.assertEqual(apikey, "key") def test_project_config(self): project_config = self.config.read_project_config( "./testfiles/zanata.xml") self.assertEqual(project_config['url'], "http://localhost:8080/zanata/") self.assertEqual(project_config['project_id'], "test-project") self.assertEqual(project_config['project_version'], "1.0") self.assertEqual(project_config['locale_map'], {"zh-CN": "zh-Hans"}) self.assertEqual(project_config['srcdir'], "/home/user/project/source") self.assertEqual(project_config['transdir'], "/home/user/project/target") self.assertEqual(project_config['file_mapping_rules']['**/pot/*.pot'], '{locale}/{path}/{filename}.po') self.assertEqual(project_config['file_mapping_rules']['**/po/*.pot'], '{path}/{locale_with_underscore}.po')
class ConfigTest(unittest.TestCase): def setUp(self): self.config = ZanataConfig() def test_user_config(self): self.config.set_userconfig("./testfiles/zanata.ini") server = self.config.get_server("http://localhost:8080/zanata") user_name = self.config.get_config_value("username", 'servers', server) apikey = self.config.get_config_value("key", 'servers', server) servers = self.config.get_servers() self.assertTrue('http://localhost:8080/zanata' in servers) self.assertEqual(server, "local") self.assertEqual(user_name, "username") self.assertEqual(apikey, "key") def test_project_config(self): project_config = self.config.read_project_config("./testfiles/zanata.xml") self.assertEqual(project_config['url'], "http://localhost:8080/zanata/") self.assertEqual(project_config['project_id'], "test-project") self.assertEqual(project_config['project_version'], "1.0") self.assertEqual(project_config['locale_map'], {"zh-CN": "zh-Hans"}) self.assertEqual(project_config['srcdir'], "/home/user/project/source") self.assertEqual(project_config['transdir'], "/home/user/project/target") self.assertEqual(project_config['file_mapping_rules']['**/pot/*.pot'], '{locale}/{path}/{filename}.po') self.assertEqual(project_config['file_mapping_rules']['**/po/*.pot'], '{path}/{locale_with_underscore}.po')
class ConfigTest(unittest.TestCase): def setUp(self): self.config = ZanataConfig() def test_user_config(self): self.config.set_userconfig("./testfiles/zanata.ini") server = self.config.get_server("http://localhost:8080/flies") user_name = self.config.get_config_value("username", "servers", server) apikey = self.config.get_config_value("key", "servers", server) self.assertEqual(server, "local") self.assertEqual(user_name, "username") self.assertEqual(apikey, "key") def test_project_config(self): project_config = self.config.read_project_config("./testfiles/zanata.xml") self.assertEqual(project_config["project_url"], "http://localhost:8080/zanata/") self.assertEqual(project_config["project_id"], "test-project") self.assertEqual(project_config["project_version"], "1.0") self.assertEqual(project_config["locale_map"], {"zh-CN": "zh-Hans"})
class ConfigTest(unittest.TestCase): def setUp(self): self.config = ZanataConfig() def test_user_config(self): self.config.set_userconfig("./testfiles/zanata.ini") server = self.config.get_server("http://localhost:8080/zanata") user_name = self.config.get_config_value("username", 'servers', server) apikey = self.config.get_config_value("key", 'servers', server) self.assertEqual(server, "local") self.assertEqual(user_name, "username") self.assertEqual(apikey, "key") def test_project_config(self): project_config = self.config.read_project_config( "./testfiles/zanata.xml") self.assertEqual(project_config['project_url'], "http://localhost:8080/zanata/") self.assertEqual(project_config['project_id'], "test-project") self.assertEqual(project_config['project_version'], "1.0") self.assertEqual(project_config['locale_map'], {"zh-CN": "zh-Hans"})
class ConfigTest(unittest.TestCase): def setUp(self): self.config = ZanataConfig() def test_user_config(self): self.config.set_userconfig("./testfiles/zanata.ini") server = self.config.get_server("http://localhost:8080/zanata") user_name = self.config.get_config_value("username", 'servers', server) apikey = self.config.get_config_value("key", 'servers', server) self.assertEqual(server, "local") self.assertEqual(user_name, "username") self.assertEqual(apikey, "key") def test_project_config(self): project_config = self.config.read_project_config("./testfiles/zanata.xml") self.assertEqual(project_config['url'], "http://localhost:8080/zanata/") self.assertEqual(project_config['project_id'], "test-project") self.assertEqual(project_config['project_version'], "1.0") self.assertEqual(project_config['locale_map'], {"zh-CN": "zh-Hans"}) self.assertEqual(project_config['srcdir'], "/home/user/project/source") self.assertEqual(project_config['transdir'], "/home/user/project/target")
def setUp(self): self.config = ZanataConfig()