Merge "Replace dict.get(key) in api & conductor tests"

This commit is contained in:
Jenkins 2016-06-24 07:50:34 +00:00 committed by Gerrit Code Review
commit 1985fbb797
2 changed files with 9 additions and 13 deletions

View File

@ -536,8 +536,7 @@ class TestListNodes(test_api_base.BaseApiTest):
def test_associated_nodes_insensitive(self):
associated_nodes = (self
._create_association_test_nodes()
.get('associated'))
._create_association_test_nodes()['associated'])
data = self.get_json('/nodes?associated=true')
data1 = self.get_json('/nodes?associated=True')
@ -555,9 +554,8 @@ class TestListNodes(test_api_base.BaseApiTest):
self.assertTrue(response.json['error_message'])
def test_unassociated_nodes_insensitive(self):
unassociated_nodes = (self
._create_association_test_nodes()
.get('unassociated'))
unassociated_nodes = (
self._create_association_test_nodes()['unassociated'])
data = self.get_json('/nodes?associated=false')
data1 = self.get_json('/nodes?associated=FALSE')
@ -568,9 +566,8 @@ class TestListNodes(test_api_base.BaseApiTest):
self.assertEqual(sorted(unassociated_nodes), sorted(uuids))
def test_unassociated_nodes_with_limit(self):
unassociated_nodes = (self
._create_association_test_nodes()
.get('unassociated'))
unassociated_nodes = (
self._create_association_test_nodes()['unassociated'])
data = self.get_json('/nodes?associated=False&limit=2')
@ -585,8 +582,7 @@ class TestListNodes(test_api_base.BaseApiTest):
def test_detail_with_association_filter(self):
associated_nodes = (self
._create_association_test_nodes()
.get('associated'))
._create_association_test_nodes()['associated'])
data = self.get_json('/nodes/detail?associated=true')
self.assertIn('driver', data['nodes'][0])
self.assertEqual(len(associated_nodes), len(data['nodes']))

View File

@ -1491,7 +1491,7 @@ class DoNodeCleanTestCase(mgr_utils.ServiceSetUpMixin,
# Node will be moved to CLEANING
self.assertEqual(states.CLEANING, node.provision_state)
self.assertEqual(states.MANAGEABLE, node.target_provision_state)
self.assertIsNone(node.driver_internal_info.get('clean_steps'))
self.assertNotIn('clean_steps', node.driver_internal_info)
self.assertIsNone(node.last_error)
@mock.patch('ironic.conductor.manager.ConductorManager._spawn_worker')
@ -1719,8 +1719,8 @@ class DoNodeCleanTestCase(mgr_utils.ServiceSetUpMixin,
self.assertEqual(states.AVAILABLE, node.provision_state)
self.assertEqual(states.NOSTATE, node.target_provision_state)
self.assertEqual({}, node.clean_step)
self.assertIsNone(node.driver_internal_info.get('clean_steps'))
self.assertIsNone(node.driver_internal_info.get('clean_step_index'))
self.assertNotIn('clean_steps', node.driver_internal_info)
self.assertNotIn('clean_step_index', node.driver_internal_info)
@mock.patch('ironic.drivers.modules.fake.FakeDeploy.prepare_cleaning')
def __do_node_clean_prepare_clean_fail(self, mock_prep, clean_steps=None):