Replace assertRaisesRegexp with assertRaisesRegex

This replaces the deprecated (in python 3.2) unittest.TestCase
method assertRaisesRegexp() with assertRaisesRegex().

Change-Id: I8c4e863faa4e1f1ef5652ecea7780e240e2d617f
Signed-off-by: Chuck Short <chucks@redhat.com>
This commit is contained in:
Chuck Short 2018-08-27 10:58:34 -04:00
parent 0792c51625
commit 5db9a878e7
2 changed files with 5 additions and 5 deletions

View File

@ -164,7 +164,7 @@ class EndpointTestCase(testtools.TestCase):
})
def test_update_authentication_with_invalid_parameter(self):
with self.assertRaisesRegexp(
with self.assertRaisesRegex(
ValueError,
'At least "username" or "password" parameter has to be specified'):
self.endpoint_inst.update_authentication()

View File

@ -112,17 +112,17 @@ class StorageServiceTestCase(testtools.TestCase):
"Erased": True}}})
def test_update_volume_with_invalid_parameter(self):
with self.assertRaisesRegexp(
with self.assertRaisesRegex(
ValueError,
'At least "bootable" or "erased" parameter has to be specified'):
self.volume_inst.update()
with self.assertRaisesRegexp(
with self.assertRaisesRegex(
exceptions.InvalidParameterValueError,
'The parameter "bootable" value "fake-value" is invalid'):
self.volume_inst.update(bootable='fake-value')
with self.assertRaisesRegexp(
with self.assertRaisesRegex(
exceptions.InvalidParameterValueError,
'The parameter "erased" value "fake-value" is invalid'):
self.volume_inst.update(bootable=True, erased='fake-value')
@ -148,7 +148,7 @@ class StorageServiceTestCase(testtools.TestCase):
data={"InitializeType": "Slow"})
def test_initialize_with_invalid_parameter(self):
with self.assertRaisesRegexp(
with self.assertRaisesRegex(
exceptions.InvalidParameterValueError,
'The parameter "init_type" value "fake-value" is invalid'
'.*[\'Fast\', \'Slow\']'):