Browse Source

[IMP] Add tests

pull/160/head
Sylvain Calador 9 years ago
parent
commit
b9219b05c9
  1. 5
      save_translation_file/tests/__init__.py
  2. 32
      save_translation_file/tests/test_save_translation_file.py

5
save_translation_file/tests/__init__.py

@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# © 2016-TODAY Akretion
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import test_save_translation_file

32
save_translation_file/tests/test_save_translation_file.py

@ -0,0 +1,32 @@
# -*- coding: utf-8 -*-
# © 2016-TODAY Akretion
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import os
from openerp.modules import get_module_path
from openerp.tools.misc import get_iso_codes
from openerp.tools.translate import load_language
import openerp.tests.common as common
class TestIrModuleModule(common.TransactionCase):
def test_button_save_translation(self):
load_language(self.cr, 'fr_FR')
condition = [('name', '=', 'save_translation_file')]
record = self.env['ir.module.module'].search(condition)
record.button_save_translation()
i18n_path = os.path.join(get_module_path(record.name), 'i18n')
lang_obj = self.env['res.lang']
condition = [('translatable', '=', True), ('code', '!=', 'en_US')]
langs = lang_obj.search(condition)
for lang in langs:
iso_code = get_iso_codes(lang.code)
path = os.path.join(i18n_path, '%s.po' % iso_code)
self.assertEqual(os.path.isfile(path), True,
'%s.po must exists' % iso_code)
Loading…
Cancel
Save