Browse Source

Replace assertEqual(None, *) with assertIsNone in tests

Replace assertEqual(None, *) with assertIsNone in tests to have
more clear messages in case of failure.

Closes-Bug: #1280522
Change-Id: I2d5285add72678b5a61b4f66879c4d066afc34c7
tags/1.0.0.0b3
Yusuke Hayashi 3 years ago
parent
commit
cb0a5c9829

+ 1
- 1
manila/tests/api/openstack/test_wsgi.py View File

@@ -14,7 +14,7 @@ class RequestTest(test.TestCase):
14 14
     def test_content_type_missing(self):
15 15
         request = wsgi.Request.blank('/tests/123', method='POST')
16 16
         request.body = six.b("<body />")
17
-        self.assertEqual(None, request.get_content_type())
17
+        self.assertIsNone(request.get_content_type())
18 18
 
19 19
     def test_content_type_unsupported(self):
20 20
         request = wsgi.Request.blank('/tests/123', method='POST')

+ 8
- 8
manila/tests/api/v1/test_limits.py View File

@@ -283,7 +283,7 @@ class LimitTest(BaseLimitTestSuite):
283 283
         """Test a limit handles 1 GET per second."""
284 284
         limit = limits.Limit("GET", "*", ".*", 1, 1)
285 285
         delay = limit("GET", "/anything")
286
-        self.assertEqual(None, delay)
286
+        self.assertIsNone(delay)
287 287
         self.assertEqual(0, limit.next_request)
288 288
         self.assertEqual(0, limit.last_request)
289 289
 
@@ -291,7 +291,7 @@ class LimitTest(BaseLimitTestSuite):
291 291
         """Test two calls to 1 GET per second limit."""
292 292
         limit = limits.Limit("GET", "*", ".*", 1, 1)
293 293
         delay = limit("GET", "/anything")
294
-        self.assertEqual(None, delay)
294
+        self.assertIsNone(delay)
295 295
 
296 296
         delay = limit("GET", "/anything")
297 297
         self.assertEqual(1, delay)
@@ -301,7 +301,7 @@ class LimitTest(BaseLimitTestSuite):
301 301
         self.time += 4
302 302
 
303 303
         delay = limit("GET", "/anything")
304
-        self.assertEqual(None, delay)
304
+        self.assertIsNone(delay)
305 305
         self.assertEqual(4, limit.next_request)
306 306
         self.assertEqual(4, limit.last_request)
307 307
 
@@ -567,25 +567,25 @@ class WsgiLimiterTest(BaseLimitTestSuite):
567 567
 
568 568
     def test_good_url(self):
569 569
         delay = self._request("GET", "/something")
570
-        self.assertEqual(delay, None)
570
+        self.assertIsNone(delay)
571 571
 
572 572
     def test_escaping(self):
573 573
         delay = self._request("GET", "/something/jump%20up")
574
-        self.assertEqual(delay, None)
574
+        self.assertIsNone(delay)
575 575
 
576 576
     def test_response_to_delays(self):
577 577
         delay = self._request("GET", "/delayed")
578
-        self.assertEqual(delay, None)
578
+        self.assertIsNone(delay)
579 579
 
580 580
         delay = self._request("GET", "/delayed")
581 581
         self.assertEqual(delay, '60.00')
582 582
 
583 583
     def test_response_to_delays_usernames(self):
584 584
         delay = self._request("GET", "/delayed", "user1")
585
-        self.assertEqual(delay, None)
585
+        self.assertIsNone(delay)
586 586
 
587 587
         delay = self._request("GET", "/delayed", "user2")
588
-        self.assertEqual(delay, None)
588
+        self.assertIsNone(delay)
589 589
 
590 590
         delay = self._request("GET", "/delayed", "user1")
591 591
         self.assertEqual(delay, '60.00')

+ 2
- 2
manila/tests/compute/test_nova.py View File

@@ -249,12 +249,12 @@ class NovaApiTestCase(test.TestCase):
249 249
     def test_fixed_ip_reserve(self):
250 250
         fixed_ip = 'fake_fixed_ip'
251 251
         result = self.api.fixed_ip_reserve(self.ctx, fixed_ip)
252
-        self.assertEqual(result, None)
252
+        self.assertIsNone(result)
253 253
 
254 254
     def test_fixed_ip_unreserve(self):
255 255
         fixed_ip = 'fake_fixed_ip'
256 256
         result = self.api.fixed_ip_unreserve(self.ctx, fixed_ip)
257
-        self.assertEqual(result, None)
257
+        self.assertIsNone(result)
258 258
 
259 259
     def test_network_get(self):
260 260
         net_id = 'fake_net_id'

+ 4
- 4
manila/tests/network/test_standalone_network_plugin.py View File

@@ -50,8 +50,8 @@ class StandaloneNetworkPluginTest(test.TestCase):
50 50
 
51 51
         self.assertEqual('10.0.0.1', instance.gateway)
52 52
         self.assertEqual('24', instance.mask)
53
-        self.assertEqual(None, instance.segmentation_id)
54
-        self.assertEqual(None, instance.allowed_ip_ranges)
53
+        self.assertIsNone(instance.segmentation_id)
54
+        self.assertIsNone(instance.allowed_ip_ranges)
55 55
         self.assertEqual(4, instance.ip_version)
56 56
         self.assertEqual(netaddr.IPNetwork('10.0.0.1/24'), instance.net)
57 57
         self.assertEqual(['10.0.0.1/24'], instance.allowed_cidrs)
@@ -111,8 +111,8 @@ class StandaloneNetworkPluginTest(test.TestCase):
111 111
         self.assertEqual(
112 112
             '2001:cdba::3257:9652', instance.gateway)
113 113
         self.assertEqual('48', instance.mask)
114
-        self.assertEqual(None, instance.segmentation_id)
115
-        self.assertEqual(None, instance.allowed_ip_ranges)
114
+        self.assertIsNone(instance.segmentation_id)
115
+        self.assertIsNone(instance.allowed_ip_ranges)
116 116
         self.assertEqual(6, instance.ip_version)
117 117
         self.assertEqual(
118 118
             netaddr.IPNetwork('2001:cdba::3257:9652/48'),

+ 2
- 2
manila/tests/share/drivers/emc/plugins/isilon/test_isilon_api.py View File

@@ -299,7 +299,7 @@ class IsilonApiTest(test.TestCase):
299 299
         r = self.isilon_api.get_nfs_export(export_id)
300 300
 
301 301
         self.assertEqual(1, len(m.request_history))
302
-        self.assertEqual(None, r)
302
+        self.assertIsNone(r)
303 303
 
304 304
     @requests_mock.mock()
305 305
     def test_lookup_smb_share(self, m):
@@ -326,7 +326,7 @@ class IsilonApiTest(test.TestCase):
326 326
         r = self.isilon_api.lookup_smb_share(share_name)
327 327
 
328 328
         self.assertEqual(1, len(m.request_history))
329
-        self.assertEqual(None, r)
329
+        self.assertIsNone(r)
330 330
 
331 331
     @ddt.data((201, True), (404, False))
332 332
     def test_create_nfs_export(self, data):

+ 8
- 8
manila/tests/share/drivers/ganesha/test_manager.py View File

@@ -267,7 +267,7 @@ class GaneshaManagerTestCase(test.TestCase):
267 267
             'ls', '/fakedir0/export.d', run_as_root=False)
268 268
         self._manager._write_conf_file.assert_called_once_with(
269 269
             'INDEX', test_index)
270
-        self.assertEqual(None, ret)
270
+        self.assertIsNone(ret)
271 271
 
272 272
     def test_read_export_file(self):
273 273
         test_args = ('cat', test_path)
@@ -322,7 +322,7 @@ class GaneshaManagerTestCase(test.TestCase):
322 322
         ret = self._manager._rm_export_file(test_name)
323 323
         self._manager._getpath.assert_called_once_with(test_name)
324 324
         self._manager.execute.assert_called_once_with('rm', test_path)
325
-        self.assertEqual(None, ret)
325
+        self.assertIsNone(ret)
326 326
 
327 327
     def test_dbus_send_ganesha(self):
328 328
         test_args = ('arg1', 'arg2')
@@ -337,14 +337,14 @@ class GaneshaManagerTestCase(test.TestCase):
337 337
             'org.ganesha.nfsd.exportmgr.fakemethod',
338 338
             *test_args, message='dbus call exportmgr.fakemethod',
339 339
             **test_kwargs)
340
-        self.assertEqual(None, ret)
340
+        self.assertIsNone(ret)
341 341
 
342 342
     def test_remove_export_dbus(self):
343 343
         self.mock_object(self._manager, '_dbus_send_ganesha')
344 344
         ret = self._manager._remove_export_dbus(test_export_id)
345 345
         self._manager._dbus_send_ganesha.assert_called_once_with(
346 346
             'RemoveExport', 'uint16:101')
347
-        self.assertEqual(None, ret)
347
+        self.assertIsNone(ret)
348 348
 
349 349
     def test_add_export(self):
350 350
         self.mock_object(self._manager, '_write_export_file',
@@ -358,7 +358,7 @@ class GaneshaManagerTestCase(test.TestCase):
358 358
             'AddExport', 'string:' + test_path,
359 359
             'string:EXPORT(Export_Id=101)')
360 360
         self._manager._mkindex.assert_called_once_with()
361
-        self.assertEqual(None, ret)
361
+        self.assertIsNone(ret)
362 362
 
363 363
     def test_add_export_error_during_mkindex(self):
364 364
         self.mock_object(self._manager, '_write_export_file',
@@ -430,7 +430,7 @@ class GaneshaManagerTestCase(test.TestCase):
430 430
             test_dict_unicode['EXPORT']['Export_Id'])
431 431
         self._manager._rm_export_file.assert_called_once_with(test_name)
432 432
         self._manager._mkindex.assert_called_once_with()
433
-        self.assertEqual(None, ret)
433
+        self.assertIsNone(ret)
434 434
 
435 435
     def test_remove_export_error_during_read_export_file(self):
436 436
         self.mock_object(
@@ -503,7 +503,7 @@ class GaneshaManagerTestCase(test.TestCase):
503 503
         ret = self._manager.restart_service()
504 504
         self._manager.execute.assert_called_once_with(
505 505
             'service', 'ganesha.fakeservice', 'restart')
506
-        self.assertEqual(None, ret)
506
+        self.assertIsNone(ret)
507 507
 
508 508
     def test_reset_exports(self):
509 509
         self.mock_object(self._manager, 'execute')
@@ -512,4 +512,4 @@ class GaneshaManagerTestCase(test.TestCase):
512 512
         self._manager.execute.assert_called_once_with(
513 513
             'sh', '-c', 'rm -f /fakedir0/export.d/*.conf')
514 514
         self._manager._mkindex.assert_called_once_with()
515
-        self.assertEqual(None, ret)
515
+        self.assertIsNone(ret)

+ 1
- 1
manila/tests/share/drivers/hds/test_sop.py View File

@@ -94,7 +94,7 @@ class SopShareDriverTestCase(test.TestCase):
94 94
         }
95 95
 
96 96
         fsadd = self._driver._add_file_system_sopapi(httpclient, fakepayload1)
97
-        self.assertEqual(None, fsadd)
97
+        self.assertIsNone(fsadd)
98 98
         httpclient.request.assert_called_once_with(
99 99
             'https://' +
100 100
             self.server['backend_details']['ip'] +

+ 3
- 3
manila/tests/share/drivers/huawei/test_huawei_nas.py View File

@@ -1248,13 +1248,13 @@ class HuaweiShareDriverTestCase(test.TestCase):
1248 1248
         self.driver.plugin.helper.login()
1249 1249
         result = self.driver.deny_access(self._context, self.share_nfs,
1250 1250
                                          self.access_user, self.share_server)
1251
-        self.assertEqual(None, result)
1251
+        self.assertIsNone(result)
1252 1252
 
1253 1253
     def test_deny_access_user_proto_fail(self):
1254 1254
         self.driver.plugin.helper.login()
1255 1255
         result = self.driver.deny_access(self._context, self.share_cifs,
1256 1256
                                          self.access_ip, self.share_server)
1257
-        self.assertEqual(None, result)
1257
+        self.assertIsNone(result)
1258 1258
 
1259 1259
     def test_allow_access_ip_share_not_exist(self):
1260 1260
         self.driver.plugin.helper.login()
@@ -1511,7 +1511,7 @@ class HuaweiShareDriverTestCase(test.TestCase):
1511 1511
         self.driver.plugin.helper.login()
1512 1512
         self.driver.plugin.helper.share_exist = False
1513 1513
         pool_name = self.driver.get_pool(self.share_nfs_host_not_exist)
1514
-        self.assertEqual(None, pool_name)
1514
+        self.assertIsNone(pool_name)
1515 1515
 
1516 1516
     def test_multi_resturls_success(self):
1517 1517
         share_type = self.fake_type_not_extra['test_with_extra']

+ 1
- 1
manila/tests/share/drivers/ibm/test_ganesha_utils.py View File

@@ -154,7 +154,7 @@ class GaneshaUtilsTestCase(test.TestCase):
154 154
         share_path = '/fs0/share-1111'
155 155
         export = ganesha_utils._get_export_by_path(self.fake_exports,
156 156
                                                    share_path)
157
-        self.assertEqual(export, None)
157
+        self.assertIsNone(export)
158 158
 
159 159
     def test_get_next_id(self):
160 160
         expected_id = 102

+ 2
- 3
manila/tests/share/drivers/quobyte/test_jsonrpc.py View File

@@ -327,9 +327,8 @@ class QuobyteJsonRpcTestCase(test.TestCase):
327 327
         resultdict = {"result": "Sweet gorilla of Manila",
328 328
                       "error": {"message": "No Gorilla",
329 329
                                 "code": jsonrpc.ERROR_ENOENT}}
330
-        self.assertEqual(None,
331
-                         self.rpc.
332
-                         _checked_for_application_error(result=resultdict))
330
+        self.assertIsNone(
331
+            self.rpc._checked_for_application_error(result=resultdict))
333 332
 
334 333
     def test_checked_for_application_error_exception(self):
335 334
         self.assertRaises(exception.QBRpcException,

+ 4
- 4
manila/tests/share/drivers/test_ganesha.py View File

@@ -174,7 +174,7 @@ class GaneshaNASHelperTestCase(test.TestCase):
174 174
         self.assertFalse(self._helper._default_config_hook.called)
175 175
         self.assertEqual(mock_ganesha_manager, self._helper.ganesha)
176 176
         self.assertEqual(mock_template, self._helper.export_template)
177
-        self.assertEqual(None, ret)
177
+        self.assertIsNone(ret)
178 178
 
179 179
     def test_init_helper_conf_dir_empty(self):
180 180
         mock_template = mock.Mock()
@@ -197,7 +197,7 @@ class GaneshaNASHelperTestCase(test.TestCase):
197 197
         self._helper._default_config_hook.assert_called_once_with()
198 198
         self.assertEqual(mock_ganesha_manager, self._helper.ganesha)
199 199
         self.assertEqual(mock_template, self._helper.export_template)
200
-        self.assertEqual(None, ret)
200
+        self.assertIsNone(ret)
201 201
 
202 202
     def test_default_config_hook(self):
203 203
         fake_template = {'key': 'value'}
@@ -240,7 +240,7 @@ class GaneshaNASHelperTestCase(test.TestCase):
240 240
             fake_basepath, self.share, self.access)
241 241
         self._helper.ganesha.add_export.assert_called_once_with(
242 242
             fake_export_name, fake_output_template)
243
-        self.assertEqual(None, ret)
243
+        self.assertIsNone(ret)
244 244
 
245 245
     def test_allow_access_error_invalid_share(self):
246 246
         access = fake_share.fake_access(access_type='notip')
@@ -252,4 +252,4 @@ class GaneshaNASHelperTestCase(test.TestCase):
252 252
         ret = self._helper.deny_access('/fakepath', self.share, self.access)
253 253
         self._helper.ganesha.remove_export.assert_called_once_with(
254 254
             'fakename--fakeaccid')
255
-        self.assertEqual(None, ret)
255
+        self.assertIsNone(ret)

+ 2
- 2
manila/tests/share/drivers/test_generic.py View File

@@ -551,7 +551,7 @@ class GenericShareDriverTestCase(test.TestCase):
551 551
 
552 552
         result = self._driver._get_volume(self._context, self.share['id'])
553 553
 
554
-        self.assertEqual(result, None)
554
+        self.assertIsNone(result)
555 555
         self._driver.volume_api.get_all.assert_called_once_with(
556 556
             self._context, {'all_tenants': True, 'name': vol_name})
557 557
 
@@ -601,7 +601,7 @@ class GenericShareDriverTestCase(test.TestCase):
601 601
                          mock.Mock(return_value=[]))
602 602
         result = self._driver._get_volume_snapshot(self._context,
603 603
                                                    self.share['id'])
604
-        self.assertEqual(result, None)
604
+        self.assertIsNone(result)
605 605
         self._driver.volume_api.get_all_snapshots.assert_called_once_with(
606 606
             self._context, {'name': snap_name})
607 607
 

+ 17
- 17
manila/tests/share/drivers/test_glusterfs.py View File

@@ -97,7 +97,7 @@ class GlusterManagerTestCase(test.TestCase):
97 97
     def test_gluster_manager_init_no_vol(self, has_volume):
98 98
         test_gluster_manager = glusterfs.GlusterManager(
99 99
             'testuser@127.0.0.1', self.fake_execf, has_volume=has_volume)
100
-        self.assertEqual(None, test_gluster_manager.volume)
100
+        self.assertIsNone(test_gluster_manager.volume)
101 101
 
102 102
     def test_gluster_manager_init_has_shouldnt_have_vol(self):
103 103
         self.assertRaises(exception.GlusterfsException,
@@ -208,7 +208,7 @@ class GlusterManagerTestCase(test.TestCase):
208 208
         self.mock_object(self._gluster_manager, 'gluster_call',
209 209
                          mock.Mock(side_effect=xml_output))
210 210
         ret = self._gluster_manager.get_gluster_vol_option(NFS_EXPORT_DIR)
211
-        self.assertEqual(None, ret)
211
+        self.assertIsNone(ret)
212 212
         self._gluster_manager.gluster_call.assert_called_once_with(*args)
213 213
 
214 214
     def test_get_gluster_vol_option(self):
@@ -271,7 +271,7 @@ class GlusterManagerTestCase(test.TestCase):
271 271
                          mock.Mock(return_value=('3', '6')))
272 272
 
273 273
         ret = self._gluster_manager.check_gluster_version((3, 5, 2))
274
-        self.assertEqual(None, ret)
274
+        self.assertIsNone(ret)
275 275
         self._gluster_manager.get_gluster_version.assert_called_once_with()
276 276
 
277 277
     def test_check_gluster_version_unmet(self):
@@ -435,7 +435,7 @@ class GlusterfsShareDriverTestCase(test.TestCase):
435 435
         expected_exec = ['true']
436 436
         ret = self._driver._do_mount(expected_exec, False)
437 437
         self.assertEqual(fake_utils.fake_execute_get_log(), expected_exec)
438
-        self.assertEqual(ret, None)
438
+        self.assertIsNone(ret)
439 439
 
440 440
     def test_do_mount_mounted_noensure(self):
441 441
         def exec_runner(*ignore_args, **ignore_kwargs):
@@ -454,7 +454,7 @@ class GlusterfsShareDriverTestCase(test.TestCase):
454 454
         fake_utils.fake_execute_set_repliers([(expected_exec[0], exec_runner)])
455 455
         ret = self._driver._do_mount(expected_exec, True)
456 456
         self.assertEqual(fake_utils.fake_execute_get_log(), expected_exec)
457
-        self.assertEqual(ret, None)
457
+        self.assertIsNone(ret)
458 458
         glusterfs.LOG.warn.assert_called_with(
459 459
             "%s is already mounted", self._driver.gluster_manager.export)
460 460
 
@@ -615,7 +615,7 @@ class GlusterfsShareDriverTestCase(test.TestCase):
615 615
         with mock.patch.object(os.path, 'join', return_value=None):
616 616
             ret = self._driver.create_share(self._context, self.share,
617 617
                                             share_server)
618
-            self.assertEqual(None, ret)
618
+            self.assertIsNone(ret)
619 619
             self._driver._get_local_share_path.called_once_with(self.share)
620 620
             self._driver._get_local_share_path.assert_called_once_with(
621 621
                 self.share)
@@ -629,7 +629,7 @@ class GlusterfsShareDriverTestCase(test.TestCase):
629 629
                                                  self.share['name'])
630 630
         os.path.exists.assert_called_once_with(fake_local_share_path)
631 631
         self.assertEqual(expected_exec, fake_utils.fake_execute_get_log())
632
-        self.assertEqual(None, ret)
632
+        self.assertIsNone(ret)
633 633
 
634 634
     def test_cleanup_create_share_cannot_cleanup_unusable_share(self):
635 635
         def exec_runner(*ignore_args, **ignore_kw):
@@ -651,7 +651,7 @@ class GlusterfsShareDriverTestCase(test.TestCase):
651 651
         ret = self._driver._cleanup_create_share(fake_local_share_path,
652 652
                                                  self.share['name'])
653 653
         os.path.exists.assert_called_once_with(fake_local_share_path)
654
-        self.assertEqual(None, ret)
654
+        self.assertIsNone(ret)
655 655
 
656 656
     def test_delete_share(self):
657 657
         self._driver._get_local_share_path =\
@@ -679,13 +679,13 @@ class GlusterfsShareDriverTestCase(test.TestCase):
679 679
         self._driver._get_local_share_path = mock.Mock()
680 680
         ret = self._driver.delete_share(self._context, self.share,
681 681
                                         share_server)
682
-        self.assertEqual(ret, None)
682
+        self.assertIsNone(ret)
683 683
         self._driver._get_local_share_path.assert_called_once_with(self.share)
684 684
 
685 685
     def test_get_helper_NFS(self):
686 686
         self._driver._helpers['NFS'] = None
687 687
         ret = self._driver._get_helper(self.share)
688
-        self.assertEqual(None, ret)
688
+        self.assertIsNone(ret)
689 689
 
690 690
     def test_get_helper_not_implemented(self):
691 691
         share = fake_share.fake_share(share_proto='Others')
@@ -700,7 +700,7 @@ class GlusterfsShareDriverTestCase(test.TestCase):
700 700
         self._driver._get_helper().\
701 701
             allow_access.assert_called_once_with(
702 702
                 '/', self.share, fake_share.fake_access)
703
-        self.assertEqual(None, ret)
703
+        self.assertIsNone(ret)
704 704
 
705 705
     def test_allow_access_can_be_called_with_extra_arg_share_server(self):
706 706
         self.mock_object(self._driver, '_get_helper')
@@ -711,7 +711,7 @@ class GlusterfsShareDriverTestCase(test.TestCase):
711 711
         self._driver._get_helper().\
712 712
             allow_access.assert_called_once_with(
713 713
                 '/', self.share, fake_share.fake_access)
714
-        self.assertEqual(None, ret)
714
+        self.assertIsNone(ret)
715 715
 
716 716
     def test_deny_access(self):
717 717
         self.mock_object(self._driver, '_get_helper')
@@ -721,7 +721,7 @@ class GlusterfsShareDriverTestCase(test.TestCase):
721 721
         self._driver._get_helper().\
722 722
             deny_access.assert_called_once_with(
723 723
                 '/', self.share, fake_share.fake_access)
724
-        self.assertEqual(None, ret)
724
+        self.assertIsNone(ret)
725 725
 
726 726
     def test_deny_access_can_be_called_with_extra_arg_share_server(self):
727 727
         self.mock_object(self._driver, '_get_helper')
@@ -732,7 +732,7 @@ class GlusterfsShareDriverTestCase(test.TestCase):
732 732
         self._driver._get_helper().\
733 733
             deny_access.assert_called_once_with(
734 734
                 '/', self.share, fake_share.fake_access)
735
-        self.assertEqual(None, ret)
735
+        self.assertIsNone(ret)
736 736
 
737 737
 
738 738
 class GlusterNFSHelperTestCase(test.TestCase):
@@ -800,7 +800,7 @@ class GlusterNFSHelperTestCase(test.TestCase):
800 800
         self._helper._get_export_dir_dict.assert_called_once_with()
801 801
         cbk.assert_called_once_with(export_dir_dict, fake_share_name,
802 802
                                     access['access_to'])
803
-        self.assertEqual(None, ret)
803
+        self.assertIsNone(ret)
804 804
 
805 805
     def test_manage_access_adding_entry(self):
806 806
 
@@ -820,7 +820,7 @@ class GlusterNFSHelperTestCase(test.TestCase):
820 820
         ret = self._helper._manage_access(fake_share_name,
821 821
                                           access['access_type'],
822 822
                                           access['access_to'], cbk)
823
-        self.assertEqual(None, ret)
823
+        self.assertIsNone(ret)
824 824
         self._helper._get_export_dir_dict.assert_called_once_with()
825 825
         self._helper.gluster_manager.gluster_call.assert_called_once_with(
826 826
             *args)
@@ -869,7 +869,7 @@ class GlusterNFSHelperTestCase(test.TestCase):
869 869
         ret = self._helper._manage_access(fake_share_name,
870 870
                                           access['access_type'],
871 871
                                           access['access_to'], cbk)
872
-        self.assertEqual(None, ret)
872
+        self.assertIsNone(ret)
873 873
         self._helper._get_export_dir_dict.assert_called_once_with()
874 874
         self._helper.gluster_manager.gluster_call.assert_called_once_with(
875 875
             *args)

+ 1
- 1
manila/tests/share/drivers/test_glusterfs_native.py View File

@@ -793,7 +793,7 @@ class GlusterfsNativeShareDriverTestCase(test.TestCase):
793 793
         self.mock_object(gmgr1, 'gluster_call',
794 794
                          mock.Mock(side_effect=GlusterXMLOut(ret=0, errno=0)))
795 795
         ret = self._driver.create_snapshot(self._context, snapshot)
796
-        self.assertEqual(None, ret)
796
+        self.assertIsNone(ret)
797 797
         gmgr1.gluster_call.assert_called_once_with(*args)
798 798
 
799 799
     def test_create_snapshot_error(self):

+ 8
- 8
manila/tests/share/drivers/test_service_instance.py View File

@@ -254,7 +254,7 @@ class ServiceInstanceManagerTestCase(test.TestCase):
254 254
         self.assertEqual(
255 255
             True,
256 256
             self._manager.get_config_option("driver_handles_share_servers"))
257
-        self.assertEqual(None, self._manager.driver_config)
257
+        self.assertIsNone(self._manager.driver_config)
258 258
         self.assertTrue(hasattr(self._manager, 'network_helper'))
259 259
         self.assertTrue(service_instance.NovaNetworkHelper.called)
260 260
         self.assertFalse(service_instance.NeutronNetworkHelper.called)
@@ -270,7 +270,7 @@ class ServiceInstanceManagerTestCase(test.TestCase):
270 270
         self.assertEqual(
271 271
             False,
272 272
             self._manager.get_config_option("driver_handles_share_servers"))
273
-        self.assertEqual(None, self._manager.driver_config)
273
+        self.assertIsNone(self._manager.driver_config)
274 274
         self.assertFalse(hasattr(self._manager, 'network_helper'))
275 275
         self.assertFalse(service_instance.NovaNetworkHelper.called)
276 276
         self.assertFalse(service_instance.NeutronNetworkHelper.called)
@@ -320,7 +320,7 @@ class ServiceInstanceManagerTestCase(test.TestCase):
320 320
         with test_utils.create_temp_config_with_opts(config_data):
321 321
             self._manager = service_instance.ServiceInstanceManager()
322 322
         result = self._manager._get_service_instance_name(fake_server_id)
323
-        self.assertEqual(None, self._manager.driver_config)
323
+        self.assertIsNone(self._manager.driver_config)
324 324
         self.assertEqual(
325 325
             self._manager.get_config_option(
326 326
                 "service_instance_name_template") % fake_server_id, result)
@@ -407,7 +407,7 @@ class ServiceInstanceManagerTestCase(test.TestCase):
407 407
                          mock.Mock(return_value=None))
408 408
         result = self._manager._get_or_create_security_group(
409 409
             self._manager.admin_context)
410
-        self.assertEqual(None, result)
410
+        self.assertIsNone(result)
411 411
         self._manager.get_config_option.assert_called_once_with(
412 412
             'service_instance_security_group')
413 413
 
@@ -2033,7 +2033,7 @@ class NeutronNetworkHelperTestCase(test.TestCase):
2033 2033
 
2034 2034
         result = instance._get_service_subnet(subnet_name)
2035 2035
 
2036
-        self.assertEqual(None, result)
2036
+        self.assertIsNone(result)
2037 2037
         instance._get_all_service_subnets.assert_called_once_with()
2038 2038
 
2039 2039
     def test__get_service_subnet_unused_found(self):
@@ -2109,9 +2109,9 @@ class NovaNetworkHelperTestCase(test.TestCase):
2109 2109
     def test_init(self):
2110 2110
         instance = service_instance.NovaNetworkHelper(self.fake_manager)
2111 2111
         self.assertEqual(service_instance.NOVA_NAME, instance.NAME)
2112
-        self.assertEqual(None, instance.teardown_network('fake'))
2113
-        self.assertEqual(
2114
-            None, instance.setup_connectivity_with_service_instances())
2112
+        self.assertIsNone(instance.teardown_network('fake'))
2113
+        self.assertIsNone(
2114
+            instance.setup_connectivity_with_service_instances())
2115 2115
 
2116 2116
     def test_get_network_name(self):
2117 2117
         network_info = dict(nova_net_id='fake_nova_net_id')

+ 1
- 1
manila/tests/share/test_driver.py View File

@@ -100,7 +100,7 @@ class ShareDriverTestCase(test.TestCase):
100 100
 
101 101
         share_driver = driver.ShareDriver(True, configuration=None)
102 102
 
103
-        self.assertEqual(None, share_driver.configuration)
103
+        self.assertIsNone(share_driver.configuration)
104 104
         network.API.assert_called_once_with(config_group_name=None)
105 105
 
106 106
     def test_get_share_stats_refresh_false(self):

+ 1
- 1
manila/tests/share/test_share_types.py View File

@@ -186,7 +186,7 @@ class ShareTypesTestCase(test.TestCase):
186 186
         actual_result = share_types.is_valid_required_extra_spec(
187 187
             'fake', 'fake')
188 188
 
189
-        self.assertEqual(None, actual_result)
189
+        self.assertIsNone(actual_result)
190 190
 
191 191
     @ddt.data('1', 'True', 'false', '0', True, False)
192 192
     def test_validate_required_extra_spec_valid(self, value):

+ 5
- 5
manila/tests/share/test_share_utils.py View File

@@ -33,8 +33,8 @@ class ShareUtilsTestCase(test.TestCase):
33 33
 
34 34
     def test_extract_host_only_return_pool(self):
35 35
         host = 'Host@Backend'
36
-        self.assertEqual(
37
-            None, share_utils.extract_host(host, 'pool'))
36
+        self.assertIsNone(
37
+            share_utils.extract_host(host, 'pool'))
38 38
 
39 39
     def test_extract_host_only_return_backend(self):
40 40
         host = 'Host@Backend'
@@ -68,8 +68,8 @@ class ShareUtilsTestCase(test.TestCase):
68 68
 
69 69
     def test_extract_host_missing_pool(self):
70 70
         host = 'Host@Backend'
71
-        self.assertEqual(
72
-            None, share_utils.extract_host(host, 'pool'))
71
+        self.assertIsNone(
72
+            share_utils.extract_host(host, 'pool'))
73 73
 
74 74
     def test_extract_host_missing_pool_use_default_pool(self):
75 75
         host = 'Host@Backend'
@@ -127,4 +127,4 @@ class ShareUtilsTestCase(test.TestCase):
127 127
         pool = None
128 128
         expected = None
129 129
         self.assertEqual(expected,
130
-                         share_utils.append_host(host, pool))
130
+                         share_utils.append_host(host, pool))

+ 1
- 1
manila/tests/test_quota.py View File

@@ -165,7 +165,7 @@ class BaseResourceTestCase(test.TestCase):
165 165
         resource = quota.BaseResource('test_resource')
166 166
 
167 167
         self.assertEqual(resource.name, 'test_resource')
168
-        self.assertEqual(resource.flag, None)
168
+        self.assertIsNone(resource.flag)
169 169
         self.assertEqual(resource.default, -1)
170 170
 
171 171
     def test_with_flag(self):

Loading…
Cancel
Save