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
changes/43/213443/5
Yusuke Hayashi 6 years ago
parent
commit
cb0a5c9829
  1. 2
      manila/tests/api/openstack/test_wsgi.py
  2. 16
      manila/tests/api/v1/test_limits.py
  3. 4
      manila/tests/compute/test_nova.py
  4. 8
      manila/tests/network/test_standalone_network_plugin.py
  5. 4
      manila/tests/share/drivers/emc/plugins/isilon/test_isilon_api.py
  6. 16
      manila/tests/share/drivers/ganesha/test_manager.py
  7. 2
      manila/tests/share/drivers/hds/test_sop.py
  8. 6
      manila/tests/share/drivers/huawei/test_huawei_nas.py
  9. 2
      manila/tests/share/drivers/ibm/test_ganesha_utils.py
  10. 5
      manila/tests/share/drivers/quobyte/test_jsonrpc.py
  11. 8
      manila/tests/share/drivers/test_ganesha.py
  12. 4
      manila/tests/share/drivers/test_generic.py
  13. 34
      manila/tests/share/drivers/test_glusterfs.py
  14. 2
      manila/tests/share/drivers/test_glusterfs_native.py
  15. 16
      manila/tests/share/drivers/test_service_instance.py
  16. 2
      manila/tests/share/test_driver.py
  17. 2
      manila/tests/share/test_share_types.py
  18. 10
      manila/tests/share/test_share_utils.py
  19. 2
      manila/tests/test_quota.py

2
manila/tests/api/openstack/test_wsgi.py

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

16
manila/tests/api/v1/test_limits.py

@ -283,7 +283,7 @@ class LimitTest(BaseLimitTestSuite):
"""Test a limit handles 1 GET per second."""
limit = limits.Limit("GET", "*", ".*", 1, 1)
delay = limit("GET", "/anything")
self.assertEqual(None, delay)
self.assertIsNone(delay)
self.assertEqual(0, limit.next_request)
self.assertEqual(0, limit.last_request)
@ -291,7 +291,7 @@ class LimitTest(BaseLimitTestSuite):
"""Test two calls to 1 GET per second limit."""
limit = limits.Limit("GET", "*", ".*", 1, 1)
delay = limit("GET", "/anything")
self.assertEqual(None, delay)
self.assertIsNone(delay)
delay = limit("GET", "/anything")
self.assertEqual(1, delay)
@ -301,7 +301,7 @@ class LimitTest(BaseLimitTestSuite):
self.time += 4
delay = limit("GET", "/anything")
self.assertEqual(None, delay)
self.assertIsNone(delay)
self.assertEqual(4, limit.next_request)
self.assertEqual(4, limit.last_request)
@ -567,25 +567,25 @@ class WsgiLimiterTest(BaseLimitTestSuite):
def test_good_url(self):
delay = self._request("GET", "/something")
self.assertEqual(delay, None)
self.assertIsNone(delay)
def test_escaping(self):
delay = self._request("GET", "/something/jump%20up")
self.assertEqual(delay, None)
self.assertIsNone(delay)
def test_response_to_delays(self):
delay = self._request("GET", "/delayed")
self.assertEqual(delay, None)
self.assertIsNone(delay)
delay = self._request("GET", "/delayed")
self.assertEqual(delay, '60.00')
def test_response_to_delays_usernames(self):
delay = self._request("GET", "/delayed", "user1")
self.assertEqual(delay, None)
self.assertIsNone(delay)
delay = self._request("GET", "/delayed", "user2")
self.assertEqual(delay, None)
self.assertIsNone(delay)
delay = self._request("GET", "/delayed", "user1")
self.assertEqual(delay, '60.00')

4
manila/tests/compute/test_nova.py

@ -249,12 +249,12 @@ class NovaApiTestCase(test.TestCase):
def test_fixed_ip_reserve(self):
fixed_ip = 'fake_fixed_ip'
result = self.api.fixed_ip_reserve(self.ctx, fixed_ip)
self.assertEqual(result, None)
self.assertIsNone(result)
def test_fixed_ip_unreserve(self):
fixed_ip = 'fake_fixed_ip'
result = self.api.fixed_ip_unreserve(self.ctx, fixed_ip)
self.assertEqual(result, None)
self.assertIsNone(result)
def test_network_get(self):
net_id = 'fake_net_id'

8
manila/tests/network/test_standalone_network_plugin.py

@ -50,8 +50,8 @@ class StandaloneNetworkPluginTest(test.TestCase):
self.assertEqual('10.0.0.1', instance.gateway)
self.assertEqual('24', instance.mask)
self.assertEqual(None, instance.segmentation_id)
self.assertEqual(None, instance.allowed_ip_ranges)
self.assertIsNone(instance.segmentation_id)
self.assertIsNone(instance.allowed_ip_ranges)
self.assertEqual(4, instance.ip_version)
self.assertEqual(netaddr.IPNetwork('10.0.0.1/24'), instance.net)
self.assertEqual(['10.0.0.1/24'], instance.allowed_cidrs)
@ -111,8 +111,8 @@ class StandaloneNetworkPluginTest(test.TestCase):
self.assertEqual(
'2001:cdba::3257:9652', instance.gateway)
self.assertEqual('48', instance.mask)
self.assertEqual(None, instance.segmentation_id)
self.assertEqual(None, instance.allowed_ip_ranges)
self.assertIsNone(instance.segmentation_id)
self.assertIsNone(instance.allowed_ip_ranges)
self.assertEqual(6, instance.ip_version)
self.assertEqual(
netaddr.IPNetwork('2001:cdba::3257:9652/48'),

4
manila/tests/share/drivers/emc/plugins/isilon/test_isilon_api.py

@ -299,7 +299,7 @@ class IsilonApiTest(test.TestCase):
r = self.isilon_api.get_nfs_export(export_id)
self.assertEqual(1, len(m.request_history))
self.assertEqual(None, r)
self.assertIsNone(r)
@requests_mock.mock()
def test_lookup_smb_share(self, m):
@ -326,7 +326,7 @@ class IsilonApiTest(test.TestCase):
r = self.isilon_api.lookup_smb_share(share_name)
self.assertEqual(1, len(m.request_history))
self.assertEqual(None, r)
self.assertIsNone(r)
@ddt.data((201, True), (404, False))
def test_create_nfs_export(self, data):

16
manila/tests/share/drivers/ganesha/test_manager.py

@ -267,7 +267,7 @@ class GaneshaManagerTestCase(test.TestCase):
'ls', '/fakedir0/export.d', run_as_root=False)
self._manager._write_conf_file.assert_called_once_with(
'INDEX', test_index)
self.assertEqual(None, ret)
self.assertIsNone(ret)
def test_read_export_file(self):
test_args = ('cat', test_path)
@ -322,7 +322,7 @@ class GaneshaManagerTestCase(test.TestCase):
ret = self._manager._rm_export_file(test_name)
self._manager._getpath.assert_called_once_with(test_name)
self._manager.execute.assert_called_once_with('rm', test_path)
self.assertEqual(None, ret)
self.assertIsNone(ret)
def test_dbus_send_ganesha(self):
test_args = ('arg1', 'arg2')
@ -337,14 +337,14 @@ class GaneshaManagerTestCase(test.TestCase):
'org.ganesha.nfsd.exportmgr.fakemethod',
*test_args, message='dbus call exportmgr.fakemethod',
**test_kwargs)
self.assertEqual(None, ret)
self.assertIsNone(ret)
def test_remove_export_dbus(self):
self.mock_object(self._manager, '_dbus_send_ganesha')
ret = self._manager._remove_export_dbus(test_export_id)
self._manager._dbus_send_ganesha.assert_called_once_with(
'RemoveExport', 'uint16:101')
self.assertEqual(None, ret)
self.assertIsNone(ret)
def test_add_export(self):
self.mock_object(self._manager, '_write_export_file',
@ -358,7 +358,7 @@ class GaneshaManagerTestCase(test.TestCase):
'AddExport', 'string:' + test_path,
'string:EXPORT(Export_Id=101)')
self._manager._mkindex.assert_called_once_with()
self.assertEqual(None, ret)
self.assertIsNone(ret)
def test_add_export_error_during_mkindex(self):
self.mock_object(self._manager, '_write_export_file',
@ -430,7 +430,7 @@ class GaneshaManagerTestCase(test.TestCase):
test_dict_unicode['EXPORT']['Export_Id'])
self._manager._rm_export_file.assert_called_once_with(test_name)
self._manager._mkindex.assert_called_once_with()
self.assertEqual(None, ret)
self.assertIsNone(ret)
def test_remove_export_error_during_read_export_file(self):
self.mock_object(
@ -503,7 +503,7 @@ class GaneshaManagerTestCase(test.TestCase):
ret = self._manager.restart_service()
self._manager.execute.assert_called_once_with(
'service', 'ganesha.fakeservice', 'restart')
self.assertEqual(None, ret)
self.assertIsNone(ret)
def test_reset_exports(self):
self.mock_object(self._manager, 'execute')
@ -512,4 +512,4 @@ class GaneshaManagerTestCase(test.TestCase):
self._manager.execute.assert_called_once_with(
'sh', '-c', 'rm -f /fakedir0/export.d/*.conf')
self._manager._mkindex.assert_called_once_with()
self.assertEqual(None, ret)
self.assertIsNone(ret)

2
manila/tests/share/drivers/hds/test_sop.py

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

6
manila/tests/share/drivers/huawei/test_huawei_nas.py

@ -1248,13 +1248,13 @@ class HuaweiShareDriverTestCase(test.TestCase):
self.driver.plugin.helper.login()
result = self.driver.deny_access(self._context, self.share_nfs,
self.access_user, self.share_server)
self.assertEqual(None, result)
self.assertIsNone(result)
def test_deny_access_user_proto_fail(self):
self.driver.plugin.helper.login()
result = self.driver.deny_access(self._context, self.share_cifs,
self.access_ip, self.share_server)
self.assertEqual(None, result)
self.assertIsNone(result)
def test_allow_access_ip_share_not_exist(self):
self.driver.plugin.helper.login()
@ -1511,7 +1511,7 @@ class HuaweiShareDriverTestCase(test.TestCase):
self.driver.plugin.helper.login()
self.driver.plugin.helper.share_exist = False
pool_name = self.driver.get_pool(self.share_nfs_host_not_exist)
self.assertEqual(None, pool_name)
self.assertIsNone(pool_name)
def test_multi_resturls_success(self):
share_type = self.fake_type_not_extra['test_with_extra']

2
manila/tests/share/drivers/ibm/test_ganesha_utils.py

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

5
manila/tests/share/drivers/quobyte/test_jsonrpc.py

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

8
manila/tests/share/drivers/test_ganesha.py

@ -174,7 +174,7 @@ class GaneshaNASHelperTestCase(test.TestCase):
self.assertFalse(self._helper._default_config_hook.called)
self.assertEqual(mock_ganesha_manager, self._helper.ganesha)
self.assertEqual(mock_template, self._helper.export_template)
self.assertEqual(None, ret)
self.assertIsNone(ret)
def test_init_helper_conf_dir_empty(self):
mock_template = mock.Mock()
@ -197,7 +197,7 @@ class GaneshaNASHelperTestCase(test.TestCase):
self._helper._default_config_hook.assert_called_once_with()
self.assertEqual(mock_ganesha_manager, self._helper.ganesha)
self.assertEqual(mock_template, self._helper.export_template)
self.assertEqual(None, ret)
self.assertIsNone(ret)
def test_default_config_hook(self):
fake_template = {'key': 'value'}
@ -240,7 +240,7 @@ class GaneshaNASHelperTestCase(test.TestCase):
fake_basepath, self.share, self.access)
self._helper.ganesha.add_export.assert_called_once_with(
fake_export_name, fake_output_template)
self.assertEqual(None, ret)
self.assertIsNone(ret)
def test_allow_access_error_invalid_share(self):
access = fake_share.fake_access(access_type='notip')
@ -252,4 +252,4 @@ class GaneshaNASHelperTestCase(test.TestCase):
ret = self._helper.deny_access('/fakepath', self.share, self.access)
self._helper.ganesha.remove_export.assert_called_once_with(
'fakename--fakeaccid')
self.assertEqual(None, ret)
self.assertIsNone(ret)

4
manila/tests/share/drivers/test_generic.py

@ -551,7 +551,7 @@ class GenericShareDriverTestCase(test.TestCase):
result = self._driver._get_volume(self._context, self.share['id'])
self.assertEqual(result, None)
self.assertIsNone(result)
self._driver.volume_api.get_all.assert_called_once_with(
self._context, {'all_tenants': True, 'name': vol_name})
@ -601,7 +601,7 @@ class GenericShareDriverTestCase(test.TestCase):
mock.Mock(return_value=[]))
result = self._driver._get_volume_snapshot(self._context,
self.share['id'])
self.assertEqual(result, None)
self.assertIsNone(result)
self._driver.volume_api.get_all_snapshots.assert_called_once_with(
self._context, {'name': snap_name})

34
manila/tests/share/drivers/test_glusterfs.py

@ -97,7 +97,7 @@ class GlusterManagerTestCase(test.TestCase):
def test_gluster_manager_init_no_vol(self, has_volume):
test_gluster_manager = glusterfs.GlusterManager(
'testuser@127.0.0.1', self.fake_execf, has_volume=has_volume)
self.assertEqual(None, test_gluster_manager.volume)
self.assertIsNone(test_gluster_manager.volume)
def test_gluster_manager_init_has_shouldnt_have_vol(self):
self.assertRaises(exception.GlusterfsException,
@ -208,7 +208,7 @@ class GlusterManagerTestCase(test.TestCase):
self.mock_object(self._gluster_manager, 'gluster_call',
mock.Mock(side_effect=xml_output))
ret = self._gluster_manager.get_gluster_vol_option(NFS_EXPORT_DIR)
self.assertEqual(None, ret)
self.assertIsNone(ret)
self._gluster_manager.gluster_call.assert_called_once_with(*args)
def test_get_gluster_vol_option(self):
@ -271,7 +271,7 @@ class GlusterManagerTestCase(test.TestCase):
mock.Mock(return_value=('3', '6')))
ret = self._gluster_manager.check_gluster_version((3, 5, 2))
self.assertEqual(None, ret)
self.assertIsNone(ret)
self._gluster_manager.get_gluster_version.assert_called_once_with()
def test_check_gluster_version_unmet(self):
@ -435,7 +435,7 @@ class GlusterfsShareDriverTestCase(test.TestCase):
expected_exec = ['true']
ret = self._driver._do_mount(expected_exec, False)
self.assertEqual(fake_utils.fake_execute_get_log(), expected_exec)
self.assertEqual(ret, None)
self.assertIsNone(ret)
def test_do_mount_mounted_noensure(self):
def exec_runner(*ignore_args, **ignore_kwargs):
@ -454,7 +454,7 @@ class GlusterfsShareDriverTestCase(test.TestCase):
fake_utils.fake_execute_set_repliers([(expected_exec[0], exec_runner)])
ret = self._driver._do_mount(expected_exec, True)
self.assertEqual(fake_utils.fake_execute_get_log(), expected_exec)
self.assertEqual(ret, None)
self.assertIsNone(ret)
glusterfs.LOG.warn.assert_called_with(
"%s is already mounted", self._driver.gluster_manager.export)
@ -615,7 +615,7 @@ class GlusterfsShareDriverTestCase(test.TestCase):
with mock.patch.object(os.path, 'join', return_value=None):
ret = self._driver.create_share(self._context, self.share,
share_server)
self.assertEqual(None, ret)
self.assertIsNone(ret)
self._driver._get_local_share_path.called_once_with(self.share)
self._driver._get_local_share_path.assert_called_once_with(
self.share)
@ -629,7 +629,7 @@ class GlusterfsShareDriverTestCase(test.TestCase):
self.share['name'])
os.path.exists.assert_called_once_with(fake_local_share_path)
self.assertEqual(expected_exec, fake_utils.fake_execute_get_log())
self.assertEqual(None, ret)
self.assertIsNone(ret)
def test_cleanup_create_share_cannot_cleanup_unusable_share(self):
def exec_runner(*ignore_args, **ignore_kw):
@ -651,7 +651,7 @@ class GlusterfsShareDriverTestCase(test.TestCase):
ret = self._driver._cleanup_create_share(fake_local_share_path,
self.share['name'])
os.path.exists.assert_called_once_with(fake_local_share_path)
self.assertEqual(None, ret)
self.assertIsNone(ret)
def test_delete_share(self):
self._driver._get_local_share_path =\
@ -679,13 +679,13 @@ class GlusterfsShareDriverTestCase(test.TestCase):
self._driver._get_local_share_path = mock.Mock()
ret = self._driver.delete_share(self._context, self.share,
share_server)
self.assertEqual(ret, None)
self.assertIsNone(ret)
self._driver._get_local_share_path.assert_called_once_with(self.share)
def test_get_helper_NFS(self):
self._driver._helpers['NFS'] = None
ret = self._driver._get_helper(self.share)
self.assertEqual(None, ret)
self.assertIsNone(ret)
def test_get_helper_not_implemented(self):
share = fake_share.fake_share(share_proto='Others')
@ -700,7 +700,7 @@ class GlusterfsShareDriverTestCase(test.TestCase):
self._driver._get_helper().\
allow_access.assert_called_once_with(
'/', self.share, fake_share.fake_access)
self.assertEqual(None, ret)
self.assertIsNone(ret)
def test_allow_access_can_be_called_with_extra_arg_share_server(self):
self.mock_object(self._driver, '_get_helper')
@ -711,7 +711,7 @@ class GlusterfsShareDriverTestCase(test.TestCase):
self._driver._get_helper().\
allow_access.assert_called_once_with(
'/', self.share, fake_share.fake_access)
self.assertEqual(None, ret)
self.assertIsNone(ret)
def test_deny_access(self):
self.mock_object(self._driver, '_get_helper')
@ -721,7 +721,7 @@ class GlusterfsShareDriverTestCase(test.TestCase):
self._driver._get_helper().\
deny_access.assert_called_once_with(
'/', self.share, fake_share.fake_access)
self.assertEqual(None, ret)
self.assertIsNone(ret)
def test_deny_access_can_be_called_with_extra_arg_share_server(self):
self.mock_object(self._driver, '_get_helper')
@ -732,7 +732,7 @@ class GlusterfsShareDriverTestCase(test.TestCase):
self._driver._get_helper().\
deny_access.assert_called_once_with(
'/', self.share, fake_share.fake_access)
self.assertEqual(None, ret)
self.assertIsNone(ret)
class GlusterNFSHelperTestCase(test.TestCase):
@ -800,7 +800,7 @@ class GlusterNFSHelperTestCase(test.TestCase):
self._helper._get_export_dir_dict.assert_called_once_with()
cbk.assert_called_once_with(export_dir_dict, fake_share_name,
access['access_to'])
self.assertEqual(None, ret)
self.assertIsNone(ret)
def test_manage_access_adding_entry(self):
@ -820,7 +820,7 @@ class GlusterNFSHelperTestCase(test.TestCase):
ret = self._helper._manage_access(fake_share_name,
access['access_type'],
access['access_to'], cbk)
self.assertEqual(None, ret)
self.assertIsNone(ret)
self._helper._get_export_dir_dict.assert_called_once_with()
self._helper.gluster_manager.gluster_call.assert_called_once_with(
*args)
@ -869,7 +869,7 @@ class GlusterNFSHelperTestCase(test.TestCase):
ret = self._helper._manage_access(fake_share_name,
access['access_type'],
access['access_to'], cbk)
self.assertEqual(None, ret)
self.assertIsNone(ret)
self._helper._get_export_dir_dict.assert_called_once_with()
self._helper.gluster_manager.gluster_call.assert_called_once_with(
*args)

2
manila/tests/share/drivers/test_glusterfs_native.py

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

16
manila/tests/share/drivers/test_service_instance.py

@ -254,7 +254,7 @@ class ServiceInstanceManagerTestCase(test.TestCase):
self.assertEqual(
True,
self._manager.get_config_option("driver_handles_share_servers"))
self.assertEqual(None, self._manager.driver_config)
self.assertIsNone(self._manager.driver_config)
self.assertTrue(hasattr(self._manager, 'network_helper'))
self.assertTrue(service_instance.NovaNetworkHelper.called)
self.assertFalse(service_instance.NeutronNetworkHelper.called)
@ -270,7 +270,7 @@ class ServiceInstanceManagerTestCase(test.TestCase):
self.assertEqual(
False,
self._manager.get_config_option("driver_handles_share_servers"))
self.assertEqual(None, self._manager.driver_config)
self.assertIsNone(self._manager.driver_config)
self.assertFalse(hasattr(self._manager, 'network_helper'))
self.assertFalse(service_instance.NovaNetworkHelper.called)
self.assertFalse(service_instance.NeutronNetworkHelper.called)
@ -320,7 +320,7 @@ class ServiceInstanceManagerTestCase(test.TestCase):
with test_utils.create_temp_config_with_opts(config_data):
self._manager = service_instance.ServiceInstanceManager()
result = self._manager._get_service_instance_name(fake_server_id)
self.assertEqual(None, self._manager.driver_config)
self.assertIsNone(self._manager.driver_config)
self.assertEqual(
self._manager.get_config_option(
"service_instance_name_template") % fake_server_id, result)
@ -407,7 +407,7 @@ class ServiceInstanceManagerTestCase(test.TestCase):
mock.Mock(return_value=None))
result = self._manager._get_or_create_security_group(
self._manager.admin_context)
self.assertEqual(None, result)
self.assertIsNone(result)
self._manager.get_config_option.assert_called_once_with(
'service_instance_security_group')
@ -2033,7 +2033,7 @@ class NeutronNetworkHelperTestCase(test.TestCase):
result = instance._get_service_subnet(subnet_name)
self.assertEqual(None, result)
self.assertIsNone(result)
instance._get_all_service_subnets.assert_called_once_with()
def test__get_service_subnet_unused_found(self):
@ -2109,9 +2109,9 @@ class NovaNetworkHelperTestCase(test.TestCase):
def test_init(self):
instance = service_instance.NovaNetworkHelper(self.fake_manager)
self.assertEqual(service_instance.NOVA_NAME, instance.NAME)
self.assertEqual(None, instance.teardown_network('fake'))
self.assertEqual(
None, instance.setup_connectivity_with_service_instances())
self.assertIsNone(instance.teardown_network('fake'))
self.assertIsNone(
instance.setup_connectivity_with_service_instances())
def test_get_network_name(self):
network_info = dict(nova_net_id='fake_nova_net_id')

2
manila/tests/share/test_driver.py

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

2
manila/tests/share/test_share_types.py

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

10
manila/tests/share/test_share_utils.py

@ -33,8 +33,8 @@ class ShareUtilsTestCase(test.TestCase):
def test_extract_host_only_return_pool(self):
host = 'Host@Backend'
self.assertEqual(
None, share_utils.extract_host(host, 'pool'))
self.assertIsNone(
share_utils.extract_host(host, 'pool'))
def test_extract_host_only_return_backend(self):
host = 'Host@Backend'
@ -68,8 +68,8 @@ class ShareUtilsTestCase(test.TestCase):
def test_extract_host_missing_pool(self):
host = 'Host@Backend'
self.assertEqual(
None, share_utils.extract_host(host, 'pool'))
self.assertIsNone(
share_utils.extract_host(host, 'pool'))
def test_extract_host_missing_pool_use_default_pool(self):
host = 'Host@Backend'
@ -127,4 +127,4 @@ class ShareUtilsTestCase(test.TestCase):
pool = None
expected = None
self.assertEqual(expected,
share_utils.append_host(host, pool))
share_utils.append_host(host, pool))

2
manila/tests/test_quota.py

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

Loading…
Cancel
Save