[FIX] some notes and comments in import/export tests

bzr revid: xmo@openerp.com-20120801094434-t23wa2343utnevh6
This commit is contained in:
Xavier Morel 2012-08-01 11:44:34 +02:00
parent e3dc738802
commit 471ef96edf
2 changed files with 13 additions and 13 deletions

View File

@ -218,6 +218,7 @@ class test_datetime(CreatorCase):
.. note:: on the other hand, export uses user lang for name_get .. note:: on the other hand, export uses user lang for name_get
""" """
# NOTE: ignores user timezone, always exports to UTC
self.assertEqual( self.assertEqual(
self.export('2011-11-07 21:05:48', context={'tz': 'Pacific/Norfolk'}), self.export('2011-11-07 21:05:48', context={'tz': 'Pacific/Norfolk'}),
[[u'2011-11-07 21:05:48']]) [[u'2011-11-07 21:05:48']])
@ -260,7 +261,6 @@ class test_selection(CreatorCase):
'src': source, 'src': source,
'value': value 'value': value
}) })
# FIXME: can't import an exported selection field label if lang != en_US
self.assertEqual( self.assertEqual(
self.export(2, context={'lang': 'fr_FR'}), self.export(2, context={'lang': 'fr_FR'}),
[[u'Bar']]) [[u'Bar']])
@ -274,8 +274,7 @@ class test_selection_function(CreatorCase):
[[False]]) [[False]])
def test_value(self): def test_value(self):
""" selection functions export the *value* itself # FIXME: selection functions export the *value* itself
"""
self.assertEqual( self.assertEqual(
self.export(1), self.export(1),
[[u'1']]) [[u'1']])

View File

@ -240,7 +240,7 @@ class test_integer_field(ImporterCase):
def test_nonsense(self): def test_nonsense(self):
# dafuq? why does that one raise an error? # FIXME: shit error reporting, exceptions half the time, messages the other half
self.assertRaises( self.assertRaises(
ValueError, ValueError,
self.import_, ['value'], [['zorglub']]) self.import_, ['value'], [['zorglub']])
@ -384,7 +384,7 @@ class test_selection(ImporterCase):
['Qux'], ['Qux'],
['Bar'], ['Bar'],
['Foo'], ['Foo'],
[2], ['2'],
]), ]),
ok(4)) ok(4))
self.assertEqual([3, 2, 1, 2], values(self.read())) self.assertEqual([3, 2, 1, 2], values(self.read()))
@ -408,6 +408,8 @@ class test_selection(ImporterCase):
'value': value 'value': value
}) })
# FIXME: can't import an exported selection field label if lang != en_US
# (see test_export.test_selection.test_localized_export)
self.assertEqual( self.assertEqual(
self.import_(['value'], [ self.import_(['value'], [
['toto'], ['toto'],
@ -443,16 +445,14 @@ class test_selection_function(ImporterCase):
] ]
def test_imported(self): def test_imported(self):
""" By what bloody magic does that thing work? """ import uses fields_get, so translates import label (may or may not
be good news) *and* serializes the selection function to reverse it:
=> import uses fields_get, so translates import label (may or may not import does not actually know that the selection field uses a function
be good news) *and* serializes the selection function to reverse
it: import does not actually know that the selection field uses a
function
""" """
# NOTE: conflict between a value and a label => ?
self.assertEqual( self.assertEqual(
self.import_(['value'], [ self.import_(['value'], [
[3], ['3'],
["Grault"], ["Grault"],
]), ]),
ok(2)) ok(2))
@ -461,6 +461,8 @@ class test_selection_function(ImporterCase):
values(self.read())) values(self.read()))
def test_translated(self): def test_translated(self):
""" Expects output of selection function returns translated labels
"""
self.registry('res.lang').create(self.cr, openerp.SUPERUSER_ID, { self.registry('res.lang').create(self.cr, openerp.SUPERUSER_ID, {
'name': u'Français', 'name': u'Français',
'code': 'fr_FR', 'code': 'fr_FR',
@ -478,7 +480,6 @@ class test_selection_function(ImporterCase):
'src': source, 'src': source,
'value': value 'value': value
}) })
# FIXME: Fucking hell
self.assertEqual( self.assertEqual(
self.import_(['value'], [ self.import_(['value'], [
['toto'], ['toto'],