From d8c0f1b7949da842e9e2095d878571e34ee01408 Mon Sep 17 00:00:00 2001 From: Josh Gachnang Date: Thu, 20 Mar 2014 15:57:20 -0700 Subject: [PATCH] Actual exception message, stylistic changes --- ironic_python_agent/ironic_api_client.py | 5 +++-- ironic_python_agent/tests/agent.py | 3 +-- ironic_python_agent/tests/ironic_api_client.py | 16 +++++----------- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/ironic_python_agent/ironic_api_client.py b/ironic_python_agent/ironic_api_client.py index e4d820c76..c9d8d44fe 100644 --- a/ironic_python_agent/ironic_api_client.py +++ b/ironic_python_agent/ironic_api_client.py @@ -97,9 +97,10 @@ class APIClient(object): if 'node' not in content or 'uuid' not in content['node']: raise errors.LookupNodeError('Got invalid node data from the API:' - ' {0}'.format(content)) + '%s' % content) if 'heartbeat_timeout' not in content: - raise errors.LookupNodeError('Got invalid') + raise errors.LookupNodeError('Got invalid heartbeat from the API:' + '%s' % content) return content def _get_agent_url(self, advertise_address): diff --git a/ironic_python_agent/tests/agent.py b/ironic_python_agent/tests/agent.py index a4f4f30b6..9d3badf1d 100644 --- a/ironic_python_agent/tests/agent.py +++ b/ironic_python_agent/tests/agent.py @@ -112,8 +112,7 @@ class TestHeartbeater(unittest.TestCase): # Validate expectations self.assertEqual(expected_stop_event_calls, - self.heartbeater.stop_event.wait.call_args_list, - ) + self.heartbeater.stop_event.wait.call_args_list) self.assertEqual(self.heartbeater.error_delay, 2.7) diff --git a/ironic_python_agent/tests/ironic_api_client.py b/ironic_python_agent/tests/ironic_api_client.py index 3eb0b4348..3fb4384b6 100644 --- a/ironic_python_agent/tests/ironic_api_client.py +++ b/ironic_python_agent/tests/ironic_api_client.py @@ -111,9 +111,7 @@ class TestBaseIronicPythonAgent(unittest.TestCase): self.api_client.session.request = mock.Mock() self.api_client.session.request.return_value = response - self.api_client.lookup_node( - hardware_info=self.hardware_info, - ) + self.api_client.lookup_node(hardware_info=self.hardware_info) request_args = self.api_client.session.request.call_args[0] self.assertEqual(request_args[0], 'POST') @@ -144,8 +142,7 @@ class TestBaseIronicPythonAgent(unittest.TestCase): self.assertRaises(errors.LookupNodeError, self.api_client.lookup_node, - hardware_info=self.hardware_info, - ) + hardware_info=self.hardware_info) def test_lookup_node_bad_response_data(self): response = httmock.response(status_code=200, content={ @@ -157,8 +154,7 @@ class TestBaseIronicPythonAgent(unittest.TestCase): self.assertRaises(errors.LookupNodeError, self.api_client.lookup_node, - hardware_info=self.hardware_info - ) + hardware_info=self.hardware_info) def test_lookup_node_no_heartbeat_timeout(self): response = httmock.response(status_code=200, content={ @@ -172,8 +168,7 @@ class TestBaseIronicPythonAgent(unittest.TestCase): self.assertRaises(errors.LookupNodeError, self.api_client.lookup_node, - hardware_info=self.hardware_info - ) + hardware_info=self.hardware_info) def test_lookup_node_bad_response_body(self): response = httmock.response(status_code=200, content={ @@ -185,5 +180,4 @@ class TestBaseIronicPythonAgent(unittest.TestCase): self.assertRaises(errors.LookupNodeError, self.api_client.lookup_node, - hardware_info=self.hardware_info, - ) + hardware_info=self.hardware_info)