Use assertRegex instead of assertRegexpMatches

In Python3, assertRegexpMatches & assertNotRegexpMatches
are deprecated in favor of assertRegex and assertNotRegex

Change-Id: I5966bf52b86e3b7ce7fb0f75c662af15a50c122e
This commit is contained in:
Vu Cong Tuan 2017-11-07 13:28:00 +07:00
parent 96b82139bb
commit 66ed951a77
4 changed files with 9 additions and 9 deletions

View File

@ -231,7 +231,7 @@ class GenericContainersTestCase(BaseContainerTestCase):
# get Location field from result and assert that it is NOT the
# malicious one.
regex = '.*{0}.*'.format(malicious_hostname)
self.assertNotRegexpMatches(resp.headers['location'], regex)
self.assertNotRegex(resp.headers['location'], regex)
@testcase.skipIf(base.conf_host_href_used, 'response href using '
'CONF.host_href instead of wsgi request')
@ -254,7 +254,7 @@ class GenericContainersTestCase(BaseContainerTestCase):
extra_headers=changed_host_header)
# Assert that returned href has provided proxy hostname
regex = '.*{0}.*'.format(another_proxy_hostname)
self.assertRegexpMatches(resp.model.container_ref, regex)
self.assertRegex(resp.model.container_ref, regex)
@utils.parameterized_test_case
@ -348,7 +348,7 @@ class RSAContainersTestCase(BaseContainerTestCase):
# get Location field from result and assert that it is NOT the
# malicious one.
regex = '.*{0}.*'.format(malicious_hostname)
self.assertNotRegexpMatches(resp.headers['location'], regex)
self.assertNotRegex(resp.headers['location'], regex)
@testcase.skipIf(base.conf_host_href_used, 'response href using '
'CONF.host_href instead of wsgi request')
@ -371,7 +371,7 @@ class RSAContainersTestCase(BaseContainerTestCase):
extra_headers=changed_host_header)
# Assert that returned href has provided proxy hostname
regex = '.*{0}.*'.format(another_proxy_hostname)
self.assertRegexpMatches(resp.model.container_ref, regex)
self.assertRegex(resp.model.container_ref, regex)
class ContainersPagingTestCase(base.PagingTestCase):

View File

@ -531,7 +531,7 @@ class OrdersTestCase(base.TestCase):
# get Location field from result and assert that it is NOT the
# malicious one.
regex = '.*{0}.*'.format(malicious_hostname)
self.assertNotRegexpMatches(resp.headers['location'], regex)
self.assertNotRegex(resp.headers['location'], regex)
@testcase.skipIf(base.conf_host_href_used, 'response href using '
'CONF.host_href instead of wsgi request')
@ -554,7 +554,7 @@ class OrdersTestCase(base.TestCase):
order_ref, extra_headers=changed_host_header)
# Assert that returned href has provided proxy hostname
regex = '.*{0}.*'.format(another_proxy_hostname)
self.assertRegexpMatches(order_resp.model.order_ref, regex)
self.assertRegex(order_resp.model.order_ref, regex)
@testcase.attr('positive')
def test_encryption_using_generated_key(self):

View File

@ -966,7 +966,7 @@ class SecretsTestCase(base.TestCase):
# get Location field from result and assert that it is NOT the
# malicious one.
regex = '.*{0}.*'.format(malicious_hostname)
self.assertNotRegexpMatches(resp.headers['location'], regex)
self.assertNotRegex(resp.headers['location'], regex)
@testcase.skipIf(base.conf_host_href_used, 'response href using '
'CONF.host_href instead of wsgi request')
@ -991,7 +991,7 @@ class SecretsTestCase(base.TestCase):
secret_ref, extra_headers=changed_host_header)
# Check returned href has provided proxy hostname
regex = '.*{0}.*'.format(another_proxy_hostname)
self.assertRegexpMatches(resp.model.secret_ref, regex)
self.assertRegex(resp.model.secret_ref, regex)
@utils.parameterized_dataset({
'symmetric': ['symmetric',

View File

@ -238,4 +238,4 @@ class ConsumersTestCase(base.TestCase):
# get Location field from result and assert that it is NOT the
# malicious one.
regex = '.*{0}.*'.format(malicious_hostname)
self.assertNotRegexpMatches(resp.headers['location'], regex)
self.assertNotRegex(resp.headers['location'], regex)