summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2017-03-22 17:23:16 +0000
committerGerrit Code Review <review@openstack.org>2017-03-22 17:23:16 +0000
commit7aa506469b22be06e092d1020190a36847b893ba (patch)
tree4bcdc5e0b933da2de544d60f75ce88c466c865b9
parent0c4e4c0bf10fb096afd606f814e8edf65921a9d9 (diff)
parent5df1c9f08d5bcedc075aeec12751b0ad39ae77ef (diff)
Merge "Use assertIsNone instead of assertEqual(None, obj)"
-rw-r--r--nailgun/nailgun/extensions/network_manager/tests/test_network_manager.py2
-rw-r--r--nailgun/nailgun/extensions/network_manager/tests/test_node_nic_handlers_w_bonding.py4
-rw-r--r--nailgun/nailgun/test/integration/test_cluster_handler.py6
-rw-r--r--nailgun/nailgun/test/integration/test_node_collection_handlers.py4
-rw-r--r--nailgun/nailgun/test/integration/test_task_managers.py2
-rw-r--r--nailgun/nailgun/test/unit/fuyaql_tests/test_fuyaql.py6
-rw-r--r--nailgun/nailgun/test/unit/test_downgrade_fuel_9_2.py4
-rw-r--r--nailgun/nailgun/test/unit/test_migration_fuel_9_2.py4
-rw-r--r--nailgun/nailgun/test/unit/test_migration_plugins_cluster_attrs_use_ids_mapping.py2
-rw-r--r--nailgun/nailgun/test/unit/test_node_assignment_handler.py6
-rw-r--r--nailgun/nailgun/test/unit/test_objects.py2
11 files changed, 21 insertions, 21 deletions
diff --git a/nailgun/nailgun/extensions/network_manager/tests/test_network_manager.py b/nailgun/nailgun/extensions/network_manager/tests/test_network_manager.py
index ee84f60..4ac9e73 100644
--- a/nailgun/nailgun/extensions/network_manager/tests/test_network_manager.py
+++ b/nailgun/nailgun/extensions/network_manager/tests/test_network_manager.py
@@ -464,7 +464,7 @@ class TestNetworkManager(BaseIntegrationTest):
464 admin_net1 = objects.NetworkGroup.get_admin_network_group(node=node0) 464 admin_net1 = objects.NetworkGroup.get_admin_network_group(node=node0)
465 admin_net2 = objects.NetworkGroup.get_admin_network_group(node=node1) 465 admin_net2 = objects.NetworkGroup.get_admin_network_group(node=node1)
466 466
467 self.assertEqual(admin_net1.group_id, None) 467 self.assertIsNone(admin_net1.group_id)
468 self.assertEqual(admin_net2.group_id, node_group.json_body['id']) 468 self.assertEqual(admin_net2.group_id, node_group.json_body['id'])
469 469
470 def test_get_admin_network_group_with_admin_net(self): 470 def test_get_admin_network_group_with_admin_net(self):
diff --git a/nailgun/nailgun/extensions/network_manager/tests/test_node_nic_handlers_w_bonding.py b/nailgun/nailgun/extensions/network_manager/tests/test_node_nic_handlers_w_bonding.py
index f764dfe..d31f35e 100644
--- a/nailgun/nailgun/extensions/network_manager/tests/test_node_nic_handlers_w_bonding.py
+++ b/nailgun/nailgun/extensions/network_manager/tests/test_node_nic_handlers_w_bonding.py
@@ -320,7 +320,7 @@ class TestNodeNICsBonding(BaseIntegrationTest):
320 ) 320 )
321 self.assertEqual(200, resp.status_code) 321 self.assertEqual(200, resp.status_code)
322 322
323 self.assertEqual(node.cluster, None) 323 self.assertIsNone(node.cluster)
324 resp = self.env.node_nics_get(node.id) 324 resp = self.env.node_nics_get(node.id)
325 self.assertEqual(resp.status_code, 200) 325 self.assertEqual(resp.status_code, 200)
326 326
@@ -341,7 +341,7 @@ class TestNodeNICsBonding(BaseIntegrationTest):
341 ) 341 )
342 self.assertEqual(resp.status_code, 200) 342 self.assertEqual(resp.status_code, 200)
343 343
344 self.assertEqual(node.cluster, None) 344 self.assertIsNone(node.cluster)
345 resp = self.env.node_nics_get(node.id) 345 resp = self.env.node_nics_get(node.id)
346 self.assertEqual(resp.status_code, 200) 346 self.assertEqual(resp.status_code, 200)
347 347
diff --git a/nailgun/nailgun/test/integration/test_cluster_handler.py b/nailgun/nailgun/test/integration/test_cluster_handler.py
index b764cc6..a302cde 100644
--- a/nailgun/nailgun/test/integration/test_cluster_handler.py
+++ b/nailgun/nailgun/test/integration/test_cluster_handler.py
@@ -179,8 +179,8 @@ class TestHandlers(BaseIntegrationTest):
179 self.assertEqual(self.db.query(Node).count(), 2) 179 self.assertEqual(self.db.query(Node).count(), 2)
180 for node in self.db.query(Node): 180 for node in self.db.query(Node):
181 self.assertEqual(node.status, 'discover') 181 self.assertEqual(node.status, 'discover')
182 self.assertEqual(node.cluster_id, None) 182 self.assertIsNone(node.cluster_id)
183 self.assertEqual(node.group_id, None) 183 self.assertIsNone(node.group_id)
184 self.assertEqual(node.roles, []) 184 self.assertEqual(node.roles, [])
185 self.assertFalse(node.pending_deletion) 185 self.assertFalse(node.pending_deletion)
186 self.assertFalse(node.pending_addition) 186 self.assertFalse(node.pending_addition)
@@ -201,7 +201,7 @@ class TestHandlers(BaseIntegrationTest):
201 201
202 node = self.db.query(Node).first() 202 node = self.db.query(Node).first()
203 self.assertEqual(node.status, 'discover') 203 self.assertEqual(node.status, 'discover')
204 self.assertEqual(node.cluster_id, None) 204 self.assertIsNone(node.cluster_id)
205 205
206 def test_cluster_deletion_delete_networks(self): 206 def test_cluster_deletion_delete_networks(self):
207 cluster = self.env.create_cluster(api=True) 207 cluster = self.env.create_cluster(api=True)
diff --git a/nailgun/nailgun/test/integration/test_node_collection_handlers.py b/nailgun/nailgun/test/integration/test_node_collection_handlers.py
index 6a97c58..ca06dcc 100644
--- a/nailgun/nailgun/test/integration/test_node_collection_handlers.py
+++ b/nailgun/nailgun/test/integration/test_node_collection_handlers.py
@@ -428,7 +428,7 @@ class TestHandlers(BaseIntegrationTest):
428 expect_http=400, 428 expect_http=400,
429 expected_error="No mac address specified" 429 expected_error="No mac address specified"
430 ) 430 )
431 self.assertEqual(node, None) 431 self.assertIsNone(node)
432 432
433 def test_node_create_with_invalid_disk_model(self): 433 def test_node_create_with_invalid_disk_model(self):
434 meta = self.env.default_metadata() 434 meta = self.env.default_metadata()
@@ -534,7 +534,7 @@ class TestHandlers(BaseIntegrationTest):
534 self.assertEqual(1, len(resp.json_body)) 534 self.assertEqual(1, len(resp.json_body))
535 self.assertEqual(node.id, resp.json_body[0]['id']) 535 self.assertEqual(node.id, resp.json_body[0]['id'])
536 self.assertEqual(node.name, node_name) 536 self.assertEqual(node.name, node_name)
537 self.assertEqual(node.cluster, None) 537 self.assertIsNone(node.cluster)
538 self.assertEqual(node.pending_roles, []) 538 self.assertEqual(node.pending_roles, [])
539 539
540 def test_discovered_node_unified_name(self): 540 def test_discovered_node_unified_name(self):
diff --git a/nailgun/nailgun/test/integration/test_task_managers.py b/nailgun/nailgun/test/integration/test_task_managers.py
index 71cddac..08ba3b6 100644
--- a/nailgun/nailgun/test/integration/test_task_managers.py
+++ b/nailgun/nailgun/test/integration/test_task_managers.py
@@ -1039,7 +1039,7 @@ class TestTaskManagers(BaseIntegrationTest):
1039 1039
1040 for node in q_nodes: 1040 for node in q_nodes:
1041 self.assertEqual(node.status, 'discover') 1041 self.assertEqual(node.status, 'discover')
1042 self.assertEqual(node.cluster_id, None) 1042 self.assertIsNone(node.cluster_id)
1043 1043
1044 @fake_tasks(recover_offline_nodes=False) 1044 @fake_tasks(recover_offline_nodes=False)
1045 def test_deletion_offline_node_when_cluster_has_only_one_node(self): 1045 def test_deletion_offline_node_when_cluster_has_only_one_node(self):
diff --git a/nailgun/nailgun/test/unit/fuyaql_tests/test_fuyaql.py b/nailgun/nailgun/test/unit/fuyaql_tests/test_fuyaql.py
index 167710e..627ce22 100644
--- a/nailgun/nailgun/test/unit/fuyaql_tests/test_fuyaql.py
+++ b/nailgun/nailgun/test/unit/fuyaql_tests/test_fuyaql.py
@@ -163,7 +163,7 @@ class TestFuyaqlController(base.BaseUnitTest):
163 self.assertRaises(self.controller.evaluate('changed($.roles)')) 163 self.assertRaises(self.controller.evaluate('changed($.roles)'))
164 164
165 def test_get_task(self, obj_mock): 165 def test_get_task(self, obj_mock):
166 self.assertEqual(self.controller._get_task(None), None) 166 self.assertIsNone(self.controller._get_task(None))
167 167
168 obj_mock.Transaction.get_by_uid.return_value = None 168 obj_mock.Transaction.get_by_uid.return_value = None
169 self.assertFalse(self.controller._get_task(1)) 169 self.assertFalse(self.controller._get_task(1))
@@ -214,13 +214,13 @@ class TestFuyaqlController(base.BaseUnitTest):
214 {'1': {'a': 2}}, 214 {'1': {'a': 2}},
215 self.controller._infos[self.controller.EXPECTED], 215 self.controller._infos[self.controller.EXPECTED],
216 ) 216 )
217 self.assertEqual(self.controller._node_id, None) 217 self.assertIsNone(self.controller._node_id)
218 218
219 self.controller._node_id = 8 219 self.controller._node_id = 8
220 self.controller._set_info(self.controller.EXPECTED, None) 220 self.controller._set_info(self.controller.EXPECTED, None)
221 self.assertEqual(self.controller._infos[self.controller.EXPECTED], 221 self.assertEqual(self.controller._infos[self.controller.EXPECTED],
222 self.new_context) 222 self.new_context)
223 self.assertEqual(self.controller._node_id, None) 223 self.assertIsNone(self.controller._node_id)
224 224
225 serialized.assert_called_once_with( 225 serialized.assert_called_once_with(
226 self.controller._cluster, 226 self.controller._cluster,
diff --git a/nailgun/nailgun/test/unit/test_downgrade_fuel_9_2.py b/nailgun/nailgun/test/unit/test_downgrade_fuel_9_2.py
index e701c48..cf0a40d 100644
--- a/nailgun/nailgun/test/unit/test_downgrade_fuel_9_2.py
+++ b/nailgun/nailgun/test/unit/test_downgrade_fuel_9_2.py
@@ -299,7 +299,7 @@ class TestAttributesDowngrade(base.BaseAlembicMigrationTest):
299 for editable in results: 299 for editable in results:
300 editable = jsonutils.loads(editable[0]) 300 editable = jsonutils.loads(editable[0])
301 common = editable.setdefault('common', {}) 301 common = editable.setdefault('common', {})
302 self.assertEqual(common.get('security_groups'), None) 302 self.assertIsNone(common.get('security_groups'))
303 303
304 def test_release_attributes_downgrade(self): 304 def test_release_attributes_downgrade(self):
305 releases = self.meta.tables['releases'] 305 releases = self.meta.tables['releases']
@@ -308,7 +308,7 @@ class TestAttributesDowngrade(base.BaseAlembicMigrationTest):
308 for attrs in results: 308 for attrs in results:
309 attrs = jsonutils.loads(attrs[0]) 309 attrs = jsonutils.loads(attrs[0])
310 common = attrs.setdefault('editable', {}).setdefault('common', {}) 310 common = attrs.setdefault('editable', {}).setdefault('common', {})
311 self.assertEqual(common.get('security_groups'), None) 311 self.assertIsNone(common.get('security_groups'))
312 312
313 313
314class TestTags(base.BaseAlembicMigrationTest): 314class TestTags(base.BaseAlembicMigrationTest):
diff --git a/nailgun/nailgun/test/unit/test_migration_fuel_9_2.py b/nailgun/nailgun/test/unit/test_migration_fuel_9_2.py
index 0a1619a..1aecb1d 100644
--- a/nailgun/nailgun/test/unit/test_migration_fuel_9_2.py
+++ b/nailgun/nailgun/test/unit/test_migration_fuel_9_2.py
@@ -624,7 +624,7 @@ class TestAttributesUpdate(base.BaseAlembicMigrationTest):
624 for attrs in results: 624 for attrs in results:
625 attrs = jsonutils.loads(attrs[0]) 625 attrs = jsonutils.loads(attrs[0])
626 common = attrs.setdefault('editable', {}).setdefault('common', {}) 626 common = attrs.setdefault('editable', {}).setdefault('common', {})
627 self.assertEqual(common.get('security_groups'), None) 627 self.assertIsNone(common.get('security_groups'))
628 628
629 def test_cluster_attributes_update(self): 629 def test_cluster_attributes_update(self):
630 clusters_attributes = self.meta.tables['attributes'] 630 clusters_attributes = self.meta.tables['attributes']
@@ -654,7 +654,7 @@ class TestAttributesUpdate(base.BaseAlembicMigrationTest):
654 for editable in results: 654 for editable in results:
655 editable = jsonutils.loads(editable[0]) 655 editable = jsonutils.loads(editable[0])
656 common = editable.setdefault('common', {}) 656 common = editable.setdefault('common', {})
657 self.assertEqual(common.get('security_groups'), None) 657 self.assertIsNone(common.get('security_groups'))
658 658
659 def test_upgrade_release_with_nic_attributes(self): 659 def test_upgrade_release_with_nic_attributes(self):
660 releases_table = self.meta.tables['releases'] 660 releases_table = self.meta.tables['releases']
diff --git a/nailgun/nailgun/test/unit/test_migration_plugins_cluster_attrs_use_ids_mapping.py b/nailgun/nailgun/test/unit/test_migration_plugins_cluster_attrs_use_ids_mapping.py
index b47d876..429806d 100644
--- a/nailgun/nailgun/test/unit/test_migration_plugins_cluster_attrs_use_ids_mapping.py
+++ b/nailgun/nailgun/test/unit/test_migration_plugins_cluster_attrs_use_ids_mapping.py
@@ -63,5 +63,5 @@ class TestMigrationPluginsClusterAttrs(BaseTestCase):
63 connection = self.db.connection() 63 connection = self.db.connection()
64 upgrade_6_0_to_6_1_plugins_cluster_attrs_use_ids_mapping(connection) 64 upgrade_6_0_to_6_1_plugins_cluster_attrs_use_ids_mapping(connection)
65 plugin_attr = self.cluster.attributes.editable['some_plugin_name'] 65 plugin_attr = self.cluster.attributes.editable['some_plugin_name']
66 self.assertEqual(plugin_attr['metadata']['plugin_id'], None) 66 self.assertIsNone(plugin_attr['metadata']['plugin_id'])
67 self.assertNotIn('plugin_version', plugin_attr['metadata']) 67 self.assertNotIn('plugin_version', plugin_attr['metadata'])
diff --git a/nailgun/nailgun/test/unit/test_node_assignment_handler.py b/nailgun/nailgun/test/unit/test_node_assignment_handler.py
index e944547..9672873 100644
--- a/nailgun/nailgun/test/unit/test_node_assignment_handler.py
+++ b/nailgun/nailgun/test/unit/test_node_assignment_handler.py
@@ -56,7 +56,7 @@ class TestAssignmentHandlers(BaseIntegrationTest):
56 ] 56 ]
57 resp = self._assign_roles(assignment_data) 57 resp = self._assign_roles(assignment_data)
58 self.assertEqual(200, resp.status_code) 58 self.assertEqual(200, resp.status_code)
59 self.assertEqual(None, resp.json_body) 59 self.assertIsNone(resp.json_body)
60 self.assertEqual(node.cluster, self.cluster) 60 self.assertEqual(node.cluster, self.cluster)
61 self.datadiff( 61 self.datadiff(
62 node.pending_roles, 62 node.pending_roles,
@@ -82,8 +82,8 @@ class TestAssignmentHandlers(BaseIntegrationTest):
82 headers=self.default_headers 82 headers=self.default_headers
83 ) 83 )
84 self.assertEqual(200, resp.status_code) 84 self.assertEqual(200, resp.status_code)
85 self.assertEqual(None, resp.json_body) 85 self.assertIsNone(resp.json_body)
86 self.assertEqual(node.cluster, None) 86 self.assertIsNone(node.cluster)
87 self.assertEqual(node.pending_roles, []) 87 self.assertEqual(node.pending_roles, [])
88 self.assertEqual(node.pending_addition, False) 88 self.assertEqual(node.pending_addition, False)
89 89
diff --git a/nailgun/nailgun/test/unit/test_objects.py b/nailgun/nailgun/test/unit/test_objects.py
index 3697cc9..a7cddd1 100644
--- a/nailgun/nailgun/test/unit/test_objects.py
+++ b/nailgun/nailgun/test/unit/test_objects.py
@@ -465,7 +465,7 @@ class TestNodeObject(BaseIntegrationTest):
465 node2_db = self.env.create_node() 465 node2_db = self.env.create_node()
466 objects.Node.remove_from_cluster(node_db) 466 objects.Node.remove_from_cluster(node_db)
467 self.db().refresh(config) 467 self.db().refresh(config)
468 self.assertEqual(node_db.cluster_id, None) 468 self.assertIsNone(node_db.cluster_id)
469 self.assertEqual(node_db.roles, []) 469 self.assertEqual(node_db.roles, [])
470 self.assertEqual(node_db.pending_roles, []) 470 self.assertEqual(node_db.pending_roles, [])
471 self.assertFalse(config.is_active) 471 self.assertFalse(config.is_active)