From dc9e87baa6930b4b628dcd4dbaf20e1f8b959c62 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Mon, 17 Dec 2018 13:28:03 +0000 Subject: [PATCH] [FIX] test_impex: use context provided The `export` method accepts a `context` parameter, but doesn't use it. This actually hides an incorrect test: when exporting in French, `Bar` should be exported as `titi`. --- odoo/addons/test_impex/tests/test_export.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/odoo/addons/test_impex/tests/test_export.py b/odoo/addons/test_impex/tests/test_export.py index f44da3ef838..1239436839c 100644 --- a/odoo/addons/test_impex/tests/test_export.py +++ b/odoo/addons/test_impex/tests/test_export.py @@ -20,11 +20,11 @@ class CreatorCase(common.TransactionCase): super(CreatorCase, self).setUp() self.model = self.env[self.model_name] - def make(self, value): - return self.model.create({'value': value}) + def make(self, value, context=None): + return self.model.with_context(**(context or {})).create({'value': value}) def export(self, value, fields=('value',), context=None): - record = self.make(value) + record = self.make(value, context=context) record.invalidate_cache() return record._export_rows([f.split('/') for f in fields]) @@ -291,7 +291,7 @@ class test_selection(CreatorCase): }) self.assertEqual( self.export(2, context={'lang': 'fr_FR'}), - [[u'Bar']]) + [[u'titi']]) class test_selection_function(CreatorCase):