Merge "Replace assertRaisesRegexp with assertRaisesRegex"
This commit is contained in:
@@ -44,7 +44,7 @@ class ClientTest(testtools.TestCase):
|
|||||||
'0', version_map)
|
'0', version_map)
|
||||||
|
|
||||||
def test_client_with_auth_system_without_auth_plugin(self):
|
def test_client_with_auth_system_without_auth_plugin(self):
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegex(
|
||||||
exceptions.AuthSystemNotFound, "AuthSystemNotFound: 'something'",
|
exceptions.AuthSystemNotFound, "AuthSystemNotFound: 'something'",
|
||||||
other_client.HTTPClient, user='user', password='password',
|
other_client.HTTPClient, user='user', password='password',
|
||||||
projectid='project', timeout=2, auth_url="http://www.blah.com",
|
projectid='project', timeout=2, auth_url="http://www.blah.com",
|
||||||
@@ -147,7 +147,7 @@ class ClientTest(testtools.TestCase):
|
|||||||
mock_request.side_effect = requests.exceptions.ConnectionError(
|
mock_request.side_effect = requests.exceptions.ConnectionError(
|
||||||
'connection refused')
|
'connection refused')
|
||||||
with mock.patch('requests.request', mock_request):
|
with mock.patch('requests.request', mock_request):
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegex(
|
||||||
exceptions.ClientException,
|
exceptions.ClientException,
|
||||||
'Unable to establish connection: connection refused',
|
'Unable to establish connection: connection refused',
|
||||||
instance.get, '/instances')
|
instance.get, '/instances')
|
||||||
|
@@ -223,7 +223,7 @@ class ShellTest(utils.TestCase):
|
|||||||
cmd = 'flavor-list --datastore_type mysql'
|
cmd = 'flavor-list --datastore_type mysql'
|
||||||
exepcted_error_msg = ('Missing argument\(s\): '
|
exepcted_error_msg = ('Missing argument\(s\): '
|
||||||
'datastore_type, datastore_version_id')
|
'datastore_type, datastore_version_id')
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegex(
|
||||||
exceptions.MissingArgs, exepcted_error_msg, self.run_command,
|
exceptions.MissingArgs, exepcted_error_msg, self.run_command,
|
||||||
cmd)
|
cmd)
|
||||||
|
|
||||||
@@ -258,7 +258,7 @@ class ShellTest(utils.TestCase):
|
|||||||
cmd = 'volume-type-list --datastore_type mysql'
|
cmd = 'volume-type-list --datastore_type mysql'
|
||||||
exepcted_error_msg = ('Missing argument\(s\): '
|
exepcted_error_msg = ('Missing argument\(s\): '
|
||||||
'datastore_type, datastore_version_id')
|
'datastore_type, datastore_version_id')
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegex(
|
||||||
exceptions.MissingArgs, exepcted_error_msg, self.run_command,
|
exceptions.MissingArgs, exepcted_error_msg, self.run_command,
|
||||||
cmd)
|
cmd)
|
||||||
|
|
||||||
@@ -390,7 +390,7 @@ class ShellTest(utils.TestCase):
|
|||||||
def test_boot_locality_error(self):
|
def test_boot_locality_error(self):
|
||||||
cmd = ('create slave-1 1 --size 1 --locality=affinity '
|
cmd = ('create slave-1 1 --size 1 --locality=affinity '
|
||||||
'--replica_of=master_1')
|
'--replica_of=master_1')
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegex(
|
||||||
exceptions.ValidationError,
|
exceptions.ValidationError,
|
||||||
'Cannot specify locality when adding replicas to existing '
|
'Cannot specify locality when adding replicas to existing '
|
||||||
'master.',
|
'master.',
|
||||||
@@ -399,7 +399,7 @@ class ShellTest(utils.TestCase):
|
|||||||
def test_boot_nic_error(self):
|
def test_boot_nic_error(self):
|
||||||
cmd = ('create test-member-1 1 --size 1 --volume_type lvm '
|
cmd = ('create test-member-1 1 --size 1 --volume_type lvm '
|
||||||
'--nic net-id=some-id,port-id=some-id')
|
'--nic net-id=some-id,port-id=some-id')
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegex(
|
||||||
exceptions.ValidationError,
|
exceptions.ValidationError,
|
||||||
'Invalid NIC argument: nic=\'net-id=some-id,port-id=some-id\'',
|
'Invalid NIC argument: nic=\'net-id=some-id,port-id=some-id\'',
|
||||||
self.run_command, cmd)
|
self.run_command, cmd)
|
||||||
@@ -474,7 +474,7 @@ class ShellTest(utils.TestCase):
|
|||||||
def test_cluster_create_error(self):
|
def test_cluster_create_error(self):
|
||||||
cmd = ('cluster-create test-clstr vertica 7.1 --instance volume=2 '
|
cmd = ('cluster-create test-clstr vertica 7.1 --instance volume=2 '
|
||||||
'--instance flavor=2,volume=1')
|
'--instance flavor=2,volume=1')
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegex(
|
||||||
exceptions.MissingArgs, "Missing option 'flavor'",
|
exceptions.MissingArgs, "Missing option 'flavor'",
|
||||||
self.run_command, cmd)
|
self.run_command, cmd)
|
||||||
|
|
||||||
@@ -592,7 +592,7 @@ class ShellTest(utils.TestCase):
|
|||||||
'port-id=some-port-id,availability_zone=2 '
|
'port-id=some-port-id,availability_zone=2 '
|
||||||
'--instance flavor=2,volume=1,nic=net-id=some-id,'
|
'--instance flavor=2,volume=1,nic=net-id=some-id,'
|
||||||
'port-id=some-port-id,availability_zone=2')
|
'port-id=some-port-id,availability_zone=2')
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegex(
|
||||||
exceptions.ValidationError, "Invalid 'nic' option. "
|
exceptions.ValidationError, "Invalid 'nic' option. "
|
||||||
"The value must be quoted.",
|
"The value must be quoted.",
|
||||||
self.run_command, cmd)
|
self.run_command, cmd)
|
||||||
@@ -603,7 +603,7 @@ class ShellTest(utils.TestCase):
|
|||||||
'availability_zone=2 '
|
'availability_zone=2 '
|
||||||
'--instance flavor=2,volume=1,nic=\'v4-fixed-ip=10.0.0.1\','
|
'--instance flavor=2,volume=1,nic=\'v4-fixed-ip=10.0.0.1\','
|
||||||
'availability_zone=2')
|
'availability_zone=2')
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegex(
|
||||||
exceptions.ValidationError, 'Invalid NIC argument',
|
exceptions.ValidationError, 'Invalid NIC argument',
|
||||||
self.run_command, cmd)
|
self.run_command, cmd)
|
||||||
|
|
||||||
@@ -626,9 +626,9 @@ class ShellTest(utils.TestCase):
|
|||||||
def test_datastore_version_show_error(self):
|
def test_datastore_version_show_error(self):
|
||||||
expected_error_msg = ('The datastore name or id is required to '
|
expected_error_msg = ('The datastore name or id is required to '
|
||||||
'retrieve a datastore version by name.')
|
'retrieve a datastore version by name.')
|
||||||
self.assertRaisesRegexp(exceptions.NoUniqueMatch, expected_error_msg,
|
self.assertRaisesRegex(exceptions.NoUniqueMatch, expected_error_msg,
|
||||||
self.run_command,
|
self.run_command,
|
||||||
'datastore-version-show v-56')
|
'datastore-version-show v-56')
|
||||||
|
|
||||||
def test_configuration_list(self):
|
def test_configuration_list(self):
|
||||||
self.run_command('configuration-list')
|
self.run_command('configuration-list')
|
||||||
@@ -660,7 +660,7 @@ class ShellTest(utils.TestCase):
|
|||||||
expected_error_msg = ('The datastore name or id is required to '
|
expected_error_msg = ('The datastore name or id is required to '
|
||||||
'retrieve the parameters for the configuration '
|
'retrieve the parameters for the configuration '
|
||||||
'group by name')
|
'group by name')
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegex(
|
||||||
exceptions.NoUniqueMatch, expected_error_msg,
|
exceptions.NoUniqueMatch, expected_error_msg,
|
||||||
self.run_command, 'configuration-parameter-list v-156')
|
self.run_command, 'configuration-parameter-list v-156')
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user