Actual exception message, stylistic changes
This commit is contained in:
parent
234d209729
commit
d8c0f1b794
ironic_python_agent
@ -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):
|
||||
|
@ -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)
|
||||
|
||||
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user