diff options
| author | Christophe Simonis <chs@odoo.com> | 2019-01-09 19:59:27 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2019-01-09 19:59:27 +0100 |
| commit | d7c5bc02cc2b27442f0d4c8aca70266762be2a32 (patch) | |
| tree | 3a675d15b539a4474be38704405b318bebecdce7 /odoo/addons/test_impex/tests/test_export.py | |
| parent | 37b518f1749aff3d6ffb2246c32f2aa1e67d9067 (diff) | |
| parent | 8aa8548d8ab68feb13f3bde51c557db84877e809 (diff) | |
[MERGE] forward port branch saas-12.1 up to 8aa8548d8ab
Diffstat (limited to 'odoo/addons/test_impex/tests/test_export.py')
| -rw-r--r-- | odoo/addons/test_impex/tests/test_export.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/odoo/addons/test_impex/tests/test_export.py b/odoo/addons/test_impex/tests/test_export.py index 058d7581bf2..264db66e992 100644 --- a/odoo/addons/test_impex/tests/test_export.py +++ b/odoo/addons/test_impex/tests/test_export.py @@ -19,11 +19,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]) @@ -242,19 +242,21 @@ class test_datetime(CreatorCase): [['']]) def test_basic(self): + """ Export value with no TZ set on the user + """ + self.env.user.write({'tz': False}) self.assertEqual( self.export('2011-11-07 21:05:48'), [[u'2011-11-07 21:05:48']]) def test_tz(self): - """ Export ignores the timezone and always exports to UTC + """ Export converts the value in the user's TZ .. note:: on the other hand, export uses user lang for name_get """ - # NOTE: ignores user timezone, always exports to UTC self.assertEqual( self.export('2011-11-07 21:05:48', context={'tz': 'Pacific/Norfolk'}), - [[u'2011-11-07 21:05:48']]) + [[u'2011-11-08 08:35:48']]) class test_selection(CreatorCase): @@ -290,7 +292,7 @@ class test_selection(CreatorCase): }) self.assertEqual( self.export(2, context={'lang': 'fr_FR'}), - [[u'Bar']]) + [[u'titi']]) class test_selection_function(CreatorCase): |
