Replace assertRaisesRegexp with assertRaisesRegex

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

Closes-Bug: #1436957

Change-Id: I7e2eb18c1b5ecdd1691d7a51087b8a29ca152d89
This commit is contained in:
rajat29 2017-05-22 11:37:26 +05:30 committed by Rajat Sharma
parent 9e068bbc47
commit fc1ca5d2c5
5 changed files with 17 additions and 17 deletions

View File

@ -328,10 +328,10 @@ class BayModelManagerTest(testtools.TestCase):
def test_baymodel_create_fail(self):
CREATE_BAYMODEL_FAIL = copy.deepcopy(CREATE_BAYMODEL)
CREATE_BAYMODEL_FAIL["wrong_key"] = "wrong"
self.assertRaisesRegexp(exceptions.InvalidAttribute,
("Key must be in %s" %
','.join(baymodels.CREATION_ATTRIBUTES)),
self.mgr.create, **CREATE_BAYMODEL_FAIL)
self.assertRaisesRegex(exceptions.InvalidAttribute,
("Key must be in %s" %
','.join(baymodels.CREATION_ATTRIBUTES)),
self.mgr.create, **CREATE_BAYMODEL_FAIL)
self.assertEqual([], self.api.calls)
def test_baymodel_delete_by_id(self):

View File

@ -272,10 +272,10 @@ class BayManagerTest(testtools.TestCase):
def test_bay_create_fail(self):
CREATE_BAY_FAIL = copy.deepcopy(CREATE_BAY)
CREATE_BAY_FAIL["wrong_key"] = "wrong"
self.assertRaisesRegexp(exceptions.InvalidAttribute,
("Key must be in %s" %
','.join(bays.CREATION_ATTRIBUTES)),
self.mgr.create, **CREATE_BAY_FAIL)
self.assertRaisesRegex(exceptions.InvalidAttribute,
("Key must be in %s" %
','.join(bays.CREATION_ATTRIBUTES)),
self.mgr.create, **CREATE_BAY_FAIL)
self.assertEqual([], self.api.calls)
def test_bay_delete_by_id(self):

View File

@ -101,10 +101,10 @@ class CertificateManagerTest(testtools.TestCase):
def test_create_fail(self):
create_cert_fail = copy.deepcopy(CREATE_CERT)
create_cert_fail["wrong_key"] = "wrong"
self.assertRaisesRegexp(exceptions.InvalidAttribute,
("Key must be in %s" %
','.join(certificates.CREATION_ATTRIBUTES)),
self.mgr.create, **create_cert_fail)
self.assertRaisesRegex(exceptions.InvalidAttribute,
("Key must be in %s" %
','.join(certificates.CREATION_ATTRIBUTES)),
self.mgr.create, **create_cert_fail)
self.assertEqual([], self.api.calls)
def test_rotate_ca(self):

View File

@ -288,10 +288,10 @@ class ClusterManagerTest(testtools.TestCase):
def test_cluster_create_fail(self):
CREATE_CLUSTER_FAIL = copy.deepcopy(CREATE_CLUSTER)
CREATE_CLUSTER_FAIL["wrong_key"] = "wrong"
self.assertRaisesRegexp(exceptions.InvalidAttribute,
("Key must be in %s" %
','.join(clusters.CREATION_ATTRIBUTES)),
self.mgr.create, **CREATE_CLUSTER_FAIL)
self.assertRaisesRegex(exceptions.InvalidAttribute,
("Key must be in %s" %
','.join(clusters.CREATION_ATTRIBUTES)),
self.mgr.create, **CREATE_CLUSTER_FAIL)
self.assertEqual([], self.api.calls)
def test_cluster_delete_by_id(self):

View File

@ -388,7 +388,7 @@ class ClusterTemplateManagerTest(testtools.TestCase):
def test_clustertemplate_create_fail(self):
CREATE_CLUSTERTEMPLATE_FAIL = copy.deepcopy(CREATE_CLUSTERTEMPLATE)
CREATE_CLUSTERTEMPLATE_FAIL["wrong_key"] = "wrong"
self.assertRaisesRegexp(
self.assertRaisesRegex(
exceptions.InvalidAttribute,
("Key must be in %s" %
','.join(cluster_templates.CREATION_ATTRIBUTES)),