Remove usage of parameter enforce_type
Oslo.config deprecated parameter enforce_type and change its default value to True in Ifa552de0a994e40388cbc9f7dbaa55700ca276b0. Remove the usage of it to avoid DeprecationWarning: "Using the 'enforce_type' argument is deprecated in version '4.0' and will be removed in version '5.0': The argument enforce_type has changed its default value to True and then will be removed completely." Related--Bug: #1517839 Change-Id: Ie3267df7e086e01eae6679cf01b3d9aa9b7a26cd
This commit is contained in:
parent
cd2c417e38
commit
f86d53da9f
@ -151,7 +151,6 @@ class TestCase(testtools.TestCase):
|
||||
|
||||
def config(self, **kw):
|
||||
"""Override config options for a test."""
|
||||
kw.setdefault('enforce_type', True)
|
||||
self.cfg_fixture.config(**kw)
|
||||
|
||||
def set_defaults(self, **kw):
|
||||
|
@ -361,10 +361,8 @@ class ServiceGetterTestCase(base.TestCase):
|
||||
|
||||
def test_out_range_auth_strategy(self):
|
||||
self.assertRaises(ValueError, cfg.CONF.set_override,
|
||||
'auth_strategy', 'fake', 'glance',
|
||||
enforce_type=True)
|
||||
'auth_strategy', 'fake', 'glance')
|
||||
|
||||
def test_out_range_glance_protocol(self):
|
||||
self.assertRaises(ValueError, cfg.CONF.set_override,
|
||||
'glance_protocol', 'fake', 'glance',
|
||||
enforce_type=True)
|
||||
'glance_protocol', 'fake', 'glance')
|
||||
|
@ -105,8 +105,7 @@ class TestNeutronClient(base.TestCase):
|
||||
|
||||
def test_out_range_auth_strategy(self, mock_client_init, mock_session):
|
||||
self.assertRaises(ValueError, cfg.CONF.set_override,
|
||||
'auth_strategy', 'fake', 'neutron',
|
||||
enforce_type=True)
|
||||
'auth_strategy', 'fake', 'neutron')
|
||||
|
||||
|
||||
class TestNeutronNetworkActions(db_base.DbTestCase):
|
||||
|
@ -56,8 +56,7 @@ class ConductorRPCAPITestCase(tests_base.TestCase):
|
||||
@mock.patch('ironic.common.rpc.get_client')
|
||||
def test_version_capped(self, mock_get_client, mock_release_mapping):
|
||||
CONF.set_override('pin_release_version',
|
||||
release_mappings.RELEASE_VERSIONS[0],
|
||||
enforce_type=True)
|
||||
release_mappings.RELEASE_VERSIONS[0])
|
||||
mock_release_mapping.get.return_value = {'rpc': '3'}
|
||||
conductor_rpcapi.ConductorAPI()
|
||||
self.assertEqual('3', mock_get_client.call_args[1]['version_cap'])
|
||||
|
@ -1047,10 +1047,7 @@ class IRMCVirtualMediaBootTestCase(db_base.DbTestCase):
|
||||
task, boot_devices.CDROM, persistent=True)
|
||||
|
||||
def test_remote_image_share_type_values(self):
|
||||
cfg.CONF.set_override('remote_image_share_type', 'cifs', 'irmc',
|
||||
enforce_type=True)
|
||||
cfg.CONF.set_override('remote_image_share_type', 'nfs', 'irmc',
|
||||
enforce_type=True)
|
||||
cfg.CONF.set_override('remote_image_share_type', 'cifs', 'irmc')
|
||||
cfg.CONF.set_override('remote_image_share_type', 'nfs', 'irmc')
|
||||
self.assertRaises(ValueError, cfg.CONF.set_override,
|
||||
'remote_image_share_type', 'fake', 'irmc',
|
||||
enforce_type=True)
|
||||
'remote_image_share_type', 'fake', 'irmc')
|
||||
|
@ -201,12 +201,12 @@ class IRMCCommonMethodsTestCase(db_base.DbTestCase):
|
||||
|
||||
def test_out_range_port(self):
|
||||
self.assertRaises(ValueError, cfg.CONF.set_override,
|
||||
'port', 60, 'irmc', enforce_type=True)
|
||||
'port', 60, 'irmc')
|
||||
|
||||
def test_out_range_auth_method(self):
|
||||
self.assertRaises(ValueError, cfg.CONF.set_override,
|
||||
'auth_method', 'fake', 'irmc', enforce_type=True)
|
||||
'auth_method', 'fake', 'irmc')
|
||||
|
||||
def test_out_range_sensor_method(self):
|
||||
self.assertRaises(ValueError, cfg.CONF.set_override,
|
||||
'sensor_method', 'fake', 'irmc', enforce_type=True)
|
||||
'sensor_method', 'fake', 'irmc')
|
||||
|
@ -547,8 +547,7 @@ class TestObjectSerializer(test_base.TestCase):
|
||||
def test_serialize_entity_backport(self, mock_release_mapping):
|
||||
"""Test single element serializer with backport."""
|
||||
CONF.set_override('pin_release_version',
|
||||
release_mappings.RELEASE_VERSIONS[-1],
|
||||
enforce_type=True)
|
||||
release_mappings.RELEASE_VERSIONS[-1])
|
||||
mock_release_mapping.__getitem__.return_value = {
|
||||
'objects': {
|
||||
'MyObj': '1.4',
|
||||
@ -571,8 +570,7 @@ class TestObjectSerializer(test_base.TestCase):
|
||||
@mock.patch('ironic.common.release_mappings.RELEASE_MAPPING')
|
||||
def test_serialize_entity_invalid_pin(self, mock_release_mapping):
|
||||
CONF.set_override('pin_release_version',
|
||||
release_mappings.RELEASE_VERSIONS[-1],
|
||||
enforce_type=True)
|
||||
release_mappings.RELEASE_VERSIONS[-1])
|
||||
mock_release_mapping.__getitem__.return_value = {
|
||||
'objects': {
|
||||
'MyObj': '1.6',
|
||||
@ -586,8 +584,7 @@ class TestObjectSerializer(test_base.TestCase):
|
||||
@mock.patch('ironic.common.release_mappings.RELEASE_MAPPING')
|
||||
def test_serialize_entity_no_pin(self, mock_release_mapping):
|
||||
CONF.set_override('pin_release_version',
|
||||
release_mappings.RELEASE_VERSIONS[-1],
|
||||
enforce_type=True)
|
||||
release_mappings.RELEASE_VERSIONS[-1])
|
||||
mock_release_mapping.__getitem__.return_value = {
|
||||
'objects': {}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user