[MERGE] res.config: fix incorrect assertion syntax in tests
bzr revid: odo@openerp.com-20130226153623-ci35l04otvk5mb3t
This commit is contained in:
commit
84a536dca6
|
@ -39,42 +39,42 @@ class test_res_config(common.TransactionCase):
|
|||
res = self.res_config.get_option_path(self.cr, self.uid, self.menu_xml_id, context=None)
|
||||
|
||||
# Check types
|
||||
self.assertTrue(isinstance(res, tuple)), "The result of get_option_path() should be a tuple (got %s)" % type(res)
|
||||
self.assertTrue(len(res) == 2), "The tuple should contain 2 elements (got %s)" % len(res)
|
||||
self.assertTrue(isinstance(res[0], basestring)), "The first element of the tuple should be a string (got %s)" % type(res[0])
|
||||
self.assertTrue(isinstance(res[1], long)), "The second element of the tuple should be an long (got %s)" % type(res[1])
|
||||
self.assertIsInstance(res, tuple)
|
||||
self.assertEqual(len(res), 2, "The result should contain 2 elements")
|
||||
self.assertIsInstance(res[0], basestring)
|
||||
self.assertIsInstance(res[1], long)
|
||||
|
||||
# Check returned values
|
||||
self.assertTrue(res[0] == self.expected_path), "Result mismatch: expected %s, got %s" % (self.expected_path, res[0])
|
||||
self.assertTrue(res[1] == self.expected_action_id), "Result mismatch: expected %s, got %s" % (self.expected_action_id, res[1])
|
||||
self.assertEqual(res[0], self.expected_path)
|
||||
self.assertEqual(res[1], self.expected_action_id)
|
||||
|
||||
def test_10_get_option_name(self):
|
||||
""" The get_option_name() method should return a string """
|
||||
res = self.res_config.get_option_name(self.cr, self.uid, self.full_field_name, context=None)
|
||||
|
||||
# Check type
|
||||
self.assertTrue(isinstance(res, basestring)), "Result type mismatch: expected basestring, got %s" % type(res)
|
||||
self.assertIsInstance(res, basestring)
|
||||
|
||||
# Check returned value
|
||||
self.assertTrue(res == self.expected_name), "Result mismatch: expected %s, got %s" % (self.expected_name, res)
|
||||
self.assertEqual(res, self.expected_name)
|
||||
|
||||
def test_20_get_config_warning(self):
|
||||
""" The get_config_warning() method should return a RedirectWarning """
|
||||
res = self.res_config.get_config_warning(self.cr, self.error_msg, context=None)
|
||||
|
||||
# Check type
|
||||
self.assertTrue(isinstance(res, openerp.exceptions.RedirectWarning)), "Result type mismatch: expected openerp.exceptions.RedirectWarning, got %s" % type(res)
|
||||
self.assertIsInstance(res, openerp.exceptions.RedirectWarning)
|
||||
|
||||
# Check returned value
|
||||
self.assertTrue(res.args[0], self.expected_final_error_msg), "Result mismatch: expected %s, got %s" % (self.expected_final_error_msg, res.args[0])
|
||||
self.assertTrue(res.args[1], self.expected_action_id), "Result mismatch: expected %s, got %s" % (self.expected_action_id, res.args[1])
|
||||
self.assertEqual(res.args[0], self.expected_final_error_msg)
|
||||
self.assertEqual(res.args[1], self.expected_action_id)
|
||||
|
||||
def test_30_get_config_warning_wo_menu(self):
|
||||
""" The get_config_warning() method should return a Warning exception """
|
||||
res = self.res_config.get_config_warning(self.cr, self.error_msg_wo_menu, context=None)
|
||||
|
||||
# Check type
|
||||
self.assertTrue(isinstance(res, openerp.exceptions.Warning)), "Result type mismatch: expected openerp.exceptions.Warning, got %s" % type(res)
|
||||
self.assertIsInstance(res, openerp.exceptions.Warning)
|
||||
|
||||
# Check returned value
|
||||
self.assertTrue(res.args[0], self.expected_final_error_msg), "Result mismatch: expected %s, got %s" % (self.expected_final_error_msg_wo_menu, res.args[0])
|
||||
self.assertEqual(res.args[0], self.expected_final_error_msg_wo_menu)
|
||||
|
|
Loading…
Reference in New Issue