[FIX] test_translation_import: correct test
Now that it is tested, actually correct it
This commit is contained in:
@@ -6,7 +6,6 @@
|
||||
'description': """A module to test translation import.""",
|
||||
'depends': ['base'],
|
||||
'data': ['view.xml'],
|
||||
'test': ['tests.yml'],
|
||||
'installable': True,
|
||||
'auto_install': False,
|
||||
}
|
||||
|
||||
@@ -14,11 +14,11 @@ msgstr ""
|
||||
"Plural-Forms: \n"
|
||||
|
||||
# Note: there is normally an additional line:
|
||||
# #: code:addons/test_translation_import/models.py:17
|
||||
# #: code:addons/test_translation_import/models.py:15
|
||||
# This line is present in the POT and removed here to test the translation
|
||||
# import behavior.
|
||||
#. module: test_translation_import
|
||||
#: field:test.translation.import,name:0
|
||||
#: model:ir.model.fields,field_description:test_translation_import.field_test_translation_import_name
|
||||
#, python-format
|
||||
msgid "1XBUO5PUYH2RYZSA1FTLRYS8SPCNU1UYXMEYMM25ASV7JC2KTJZQESZYRV9L8CGB"
|
||||
msgstr "1XBUO5PUYH2RYZSA1FTLRYS8SPCNU1UYXMEYMM25ASV7JC2KTJZQESZYRV9L8CGB in french"
|
||||
@@ -49,4 +49,3 @@ msgstr "Test translation import in french"
|
||||
#: model:ir.ui.menu,name:test_translation_import.menu_test_translation
|
||||
msgid "Test translation"
|
||||
msgstr "Test translation in french"
|
||||
|
||||
|
||||
@@ -23,8 +23,8 @@ msgstr ""
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: test_translation_import
|
||||
#: code:addons/test_translation_import/models.py:17
|
||||
#: field:test.translation.import,name:0
|
||||
#: code:addons/test_translation_import/models.py:15
|
||||
#: model:ir.model.fields,field_description:test_translation_import.field_test_translation_import_name
|
||||
#, python-format
|
||||
msgid "1XBUO5PUYH2RYZSA1FTLRYS8SPCNU1UYXMEYMM25ASV7JC2KTJZQESZYRV9L8CGB"
|
||||
msgstr ""
|
||||
@@ -55,4 +55,3 @@ msgstr ""
|
||||
#: model:ir.ui.menu,name:test_translation_import.menu_test_translation
|
||||
msgid "Test translation"
|
||||
msgstr ""
|
||||
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
-
|
||||
Load the french translation.
|
||||
-
|
||||
!python {model: ir.translation }: |
|
||||
import odoo
|
||||
odoo.tools.trans_load(cr, 'test_translation_import/i18n/fr.po', 'fr_FR', verbose=False)
|
||||
-
|
||||
Assert we have loaded the correct number of entries for the given source string.
|
||||
-
|
||||
!python {model: ir.translation }: |
|
||||
translations = self.search(
|
||||
[('src', '=', '1XBUO5PUYH2RYZSA1FTLRYS8SPCNU1UYXMEYMM25ASV7JC2KTJZQESZYRV9L8CGB')])
|
||||
assert len(translations) == 2, "2 entries are expected, got %s instead." % len(translations)
|
||||
@@ -9,7 +9,7 @@ class TestTermCount(common.TransactionCase):
|
||||
"""
|
||||
Just make sure we have as many translation entries as we wanted.
|
||||
"""
|
||||
odoo.tools.trans_load(self.cr, 'test_translation_import/i18n/fr.po', 'fr_FR', verbose=False)
|
||||
odoo.tools.trans_load(self.cr, 'test_translation_import/i18n/fr.po', 'fr_FR', module_name='test_translation_import', verbose=False)
|
||||
ids = self.env['ir.translation'].search(
|
||||
[('src', '=', '1XBUO5PUYH2RYZSA1FTLRYS8SPCNU1UYXMEYMM25ASV7JC2KTJZQESZYRV9L8CGB')])
|
||||
self.assertEqual(len(ids), 2)
|
||||
@@ -21,10 +21,10 @@ class TestTermCount(common.TransactionCase):
|
||||
menu = self.env.ref('test_translation_import.menu_test_translation_import')
|
||||
menu.name = "New Name"
|
||||
# install french and change translation content
|
||||
odoo.tools.trans_load(self.cr, 'test_translation_import/i18n/fr.po', 'fr_FR', verbose=False)
|
||||
odoo.tools.trans_load(self.cr, 'test_translation_import/i18n/fr.po', 'fr_FR', module_name='test_translation_import', verbose=False)
|
||||
menu.with_context(lang='fr_FR').name = "Nouveau nom"
|
||||
# reload with overwrite
|
||||
odoo.tools.trans_load(self.cr, 'test_translation_import/i18n/fr.po', 'fr_FR', verbose=False, context={'overwrite': True})
|
||||
odoo.tools.trans_load(self.cr, 'test_translation_import/i18n/fr.po', 'fr_FR', module_name='test_translation_import', verbose=False, context={'overwrite': True})
|
||||
|
||||
# trans_load invalidates ormcache but not record cache
|
||||
menu.refresh()
|
||||
|
||||
Reference in New Issue
Block a user