class ImportExportTestSuite(NaayaTestCase): def setUp(self): self.catalog = NyMessageCatalog('id', 'title', ('en', 'de')) self.tool = TranslationsImportExport(self.catalog) self.catalog.edit_message('Administration', 'de', 'Verwaltung') self.catalog.edit_message('${x} <b>"apples"</b>', 'de', u'${x} <b>"Äpfel"</b>') def test_export_po(self): exported = self.tool.export_po('en') self.assertEqual(exported, expected_po_en()) exported = self.tool.export_po('de') self.assertEqual(exported, expected_po_de()) def test_export_xliff(self): exported = self.tool.export_xliff('de') self.assertEqual(exported, expected_xliff_de()) def test_export_tmx(self): exported = self.tool.export_tmx() self.assertEqual(exported, expected_tmx()) def test_export_import(self): exported = self.tool.export_po('de') self.assertEqual(exported, expected_po_de()) self.catalog.clear() bytestream = StringIO(exported) self.tool.import_po('de', bytestream) self.assertEqual(self.catalog.gettext('Administration', 'de'), 'Verwaltung') self.assertTrue(self.catalog.gettext('${x} <b>"apples"</b>', 'de') == u'${x} <b>"Äpfel"</b>')
def setUp(self): self.catalog = NyMessageCatalog('id', 'title', ('en', 'de')) self.tool = TranslationsImportExport(self.catalog) self.catalog.edit_message('Administration', 'de', 'Verwaltung') self.catalog.edit_message('${x} <b>"apples"</b>', 'de', u'${x} <b>"Äpfel"</b>')