You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
1.1 KiB

9 years ago
  1. # -*- coding: utf-8 -*-
  2. # © 2016-TODAY Akretion
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  4. import os
  5. from openerp.modules import get_module_path
  6. from openerp.tools.misc import get_iso_codes
  7. from openerp.tools.translate import load_language
  8. import openerp.tests.common as common
  9. class TestIrModuleModule(common.TransactionCase):
  10. def test_button_save_translation(self):
  11. load_language(self.cr, 'fr_FR')
  12. condition = [('name', '=', 'save_translation_file')]
  13. record = self.env['ir.module.module'].search(condition)
  14. record.button_save_translation()
  15. i18n_path = os.path.join(get_module_path(record.name), 'i18n')
  16. lang_obj = self.env['res.lang']
  17. condition = [('translatable', '=', True), ('code', '!=', 'en_US')]
  18. langs = lang_obj.search(condition)
  19. for lang in langs:
  20. iso_code = get_iso_codes(lang.code)
  21. path = os.path.join(i18n_path, '%s.po' % iso_code)
  22. self.assertEqual(os.path.isfile(path), True,
  23. '%s.po must exists' % iso_code)