From: Lars Hupfeldt Date: Thu, 13 Feb 2014 19:28:09 +0000 (+0100) Subject: exception.message -> str(exception) X-Git-Tag: v0.2.23~23^2~4^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f81e5d360e9acee421093a639b184eb1e839cbef;p=tools%2Fpython-jenkinsapi.git exception.message -> str(exception) --- diff --git a/jenkinsapi_tests/systests/test_parameterized_builds.py b/jenkinsapi_tests/systests/test_parameterized_builds.py index 680feb4..205fc78 100644 --- a/jenkinsapi_tests/systests/test_parameterized_builds.py +++ b/jenkinsapi_tests/systests/test_parameterized_builds.py @@ -88,7 +88,7 @@ class TestParameterizedBuilds(BaseSystemTest): with self.assertRaises(WillNotBuild) as na: job.invoke(build_params=params) expected_msg = 'A build with these parameters is already queued.' - self.assertEqual(na.exception.message, expected_msg) + self.assertEqual(str(na.exception), expected_msg) if __name__ == '__main__': diff --git a/jenkinsapi_tests/unittests/test_jenkins.py b/jenkinsapi_tests/unittests/test_jenkins.py index fa39055..9066a3a 100644 --- a/jenkinsapi_tests/unittests/test_jenkins.py +++ b/jenkinsapi_tests/unittests/test_jenkins.py @@ -252,7 +252,7 @@ class TestJenkins(unittest.TestCase): with self.assertRaises(JenkinsAPIException) as ar: J.create_job('job_new', None) - self.assertEquals(ar.exception.message, 'Cannot create job job_new') + self.assertEquals(str(ar.exception), 'Cannot create job job_new') @mock.patch.object(JenkinsBase, '_poll') @mock.patch.object(Jenkins, '_poll') diff --git a/jenkinsapi_tests/unittests/test_job.py b/jenkinsapi_tests/unittests/test_job.py index 82e7e21..d8d401f 100644 --- a/jenkinsapi_tests/unittests/test_job.py +++ b/jenkinsapi_tests/unittests/test_job.py @@ -91,7 +91,7 @@ class TestJob(unittest.TestCase): self.j._mk_json_from_build_parameters(build_params='bad parameter') self.assertEquals( - ar.exception.message, 'Build parameters must be a dict') + str(ar.exception), 'Build parameters must be a dict') def test__mk_json_from_build_parameters(self): params = {'param1': 'value1', 'param2': 'value2'} @@ -105,7 +105,7 @@ class TestJob(unittest.TestCase): self.j.mk_json_from_build_parameters(build_params='bad parameter') self.assertEquals( - ar.exception.message, 'Build parameters must be a dict') + str(ar.exception), 'Build parameters must be a dict') @mock.patch.object(JenkinsBase, 'get_data', fakeGetData) def test_wrong_field__build_id_for_type(self): diff --git a/jenkinsapi_tests/unittests/test_job_multiconf.py b/jenkinsapi_tests/unittests/test_job_multiconf.py index 335f741..b994bdd 100644 --- a/jenkinsapi_tests/unittests/test_job_multiconf.py +++ b/jenkinsapi_tests/unittests/test_job_multiconf.py @@ -111,7 +111,7 @@ # self.j._mk_json_from_build_parameters(build_params='bad parameter') # self.assertEquals( -# ar.exception.message, 'Build parameters must be a dict') +# str(ar.exception), 'Build parameters must be a dict') # def test__mk_json_from_build_parameters(self): # params = {'param1': 'value1', 'param2': 'value2'} @@ -125,7 +125,7 @@ # self.j.mk_json_from_build_parameters(build_params='bad parameter') # self.assertEquals( -# ar.exception.message, 'Build parameters must be a dict') +# str(ar.exception), 'Build parameters must be a dict') # @mock.patch.object(JenkinsBase, 'get_data', fakeGetData) # def test_wrong_field__build_id_for_type(self): diff --git a/jenkinsapi_tests/unittests/test_requester.py b/jenkinsapi_tests/unittests/test_requester.py index 86502b4..521e1df 100644 --- a/jenkinsapi_tests/unittests/test_requester.py +++ b/jenkinsapi_tests/unittests/test_requester.py @@ -31,7 +31,7 @@ class TestQueue(unittest.TestCase): data=None, headers=None ) - self.assertTrue(na.exception.message == "Params must be a dict, got 'wrong'") + self.assertTrue(str(na.exception) == "Params must be a dict, got 'wrong'") def test_get_request_dict_correct_params(self): req = Requester('foo', 'bar') @@ -55,7 +55,7 @@ class TestQueue(unittest.TestCase): data=None, headers='wrong' ) - self.assertTrue(na.exception.message == "headers must be a dict, got 'wrong'") + self.assertTrue(str(na.exception) == "headers must be a dict, got 'wrong'") def test_get_request_dict_correct_headers(self): req = Requester('foo', 'bar') @@ -127,7 +127,7 @@ class TestQueue(unittest.TestCase): data=None ) - self.assertTrue(ae.exception.message == "Unexpected type of parameter 'data': . Expected (str, dict)") + self.assertTrue(str(ae.exception) == "Unexpected type of parameter 'data': . Expected (str, dict)") @mock.patch.object(requests, 'post') def test_post_xml_and_confirm_status_some_xml(self, _post): @@ -153,7 +153,7 @@ class TestQueue(unittest.TestCase): data=None ) - self.assertTrue(ae.exception.message == "Unexpected type of parameter 'data': . Expected (str, dict)") + self.assertTrue(str(ae.exception) == "Unexpected type of parameter 'data': . Expected (str, dict)") @mock.patch.object(requests, 'post') def test_post_and_confirm_status_some_data(self, _post): @@ -182,8 +182,8 @@ class TestQueue(unittest.TestCase): data='some data' ) - print(ae.exception.message) - self.assertTrue(ae.exception.message == "Operation failed. url=None, data=some data, headers={'Content-Type': 'application/x-www-form-urlencoded'}, status=500, text=") + print(str(ae.exception)) + self.assertTrue(str(ae.exception) == "Operation failed. url=None, data=some data, headers={'Content-Type': 'application/x-www-form-urlencoded'}, status=500, text=") @mock.patch.object(requests, 'get') def test_get_and_confirm_status(self, _get): @@ -210,8 +210,8 @@ class TestQueue(unittest.TestCase): params={'param': 'value'} ) - print(ae.exception.message) - self.assertTrue(ae.exception.message == "Operation failed. url=None, headers=None, status=500, text=") + print(str(ae.exception)) + self.assertTrue(str(ae.exception) == "Operation failed. url=None, headers=None, status=500, text=") if __name__ == "__main__": unittest.main()