[IMP] use assertEqual instead of assertTrue and fix a test

bzr revid: abo@openerp.com-20130226104541-hmzla9y2sa3qfqgi
This commit is contained in:
Antonin Bourguignon 2013-02-26 11:45:41 +01:00
parent dee8cc8e50
commit 1aef18870f
1 changed files with 7 additions and 7 deletions

View File

@ -40,13 +40,13 @@ class test_res_config(common.TransactionCase):
# 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.assertEqual(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])
# 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 """
@ -56,7 +56,7 @@ class test_res_config(common.TransactionCase):
self.assertTrue(isinstance(res, basestring)), "Result type mismatch: expected basestring, got %s" % type(res)
# 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 """
@ -66,8 +66,8 @@ class test_res_config(common.TransactionCase):
self.assertTrue(isinstance(res, openerp.exceptions.RedirectWarning)), "Result type mismatch: expected openerp.exceptions.RedirectWarning, got %s" % type(res)
# 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 """
@ -77,4 +77,4 @@ class test_res_config(common.TransactionCase):
self.assertTrue(isinstance(res, openerp.exceptions.Warning)), "Result type mismatch: expected openerp.exceptions.Warning, got %s" % type(res)
# 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)