Merge "Remove six.assertRaisesRegex usage"
This commit is contained in:
commit
4f4fc9b15d
@ -26,7 +26,6 @@ import glance_store as store
|
||||
from oslo_config import cfg
|
||||
from oslo_serialization import jsonutils
|
||||
from oslo_utils import fixture
|
||||
import six
|
||||
import testtools
|
||||
import webob
|
||||
import webob.exc
|
||||
@ -2313,10 +2312,9 @@ class TestImagesController(base.IsolatedUnitTest):
|
||||
'os_hash_value': MULTIHASH1}}
|
||||
changes = [{'op': 'add', 'path': ['locations', '-'],
|
||||
'value': new_location}]
|
||||
six.assertRaisesRegex(self,
|
||||
self.assertRaisesRegex(
|
||||
webob.exc.HTTPConflict,
|
||||
"may only be provided when image status "
|
||||
"is 'queued'",
|
||||
"may only be provided when image status is 'queued'",
|
||||
self.controller.update,
|
||||
request, image_id, changes)
|
||||
|
||||
@ -2355,7 +2353,7 @@ class TestImagesController(base.IsolatedUnitTest):
|
||||
'os_hash_value': MULTIHASH2}}
|
||||
changes = [{'op': 'replace', 'path': ['locations'],
|
||||
'value': [new_location]}]
|
||||
six.assertRaisesRegex(self,
|
||||
self.assertRaisesRegex(
|
||||
webob.exc.HTTPConflict,
|
||||
"already set with a different value",
|
||||
self.controller.update,
|
||||
@ -2527,7 +2525,7 @@ class TestImagesController(base.IsolatedUnitTest):
|
||||
'os_hash_algo': 'sha512',
|
||||
'os_hash_value': MULTIHASH1,
|
||||
}
|
||||
six.assertRaisesRegex(self,
|
||||
self.assertRaisesRegex(
|
||||
webob.exc.HTTPConflict,
|
||||
'checksum .* is not a valid hexadecimal value',
|
||||
self.controller.update,
|
||||
@ -2538,7 +2536,7 @@ class TestImagesController(base.IsolatedUnitTest):
|
||||
'os_hash_algo': 'sha512',
|
||||
'os_hash_value': MULTIHASH1,
|
||||
}
|
||||
six.assertRaisesRegex(self,
|
||||
self.assertRaisesRegex(
|
||||
webob.exc.HTTPConflict,
|
||||
'checksum .* is not the correct size',
|
||||
self.controller.update,
|
||||
@ -2549,7 +2547,7 @@ class TestImagesController(base.IsolatedUnitTest):
|
||||
'os_hash_algo': 'sha256',
|
||||
'os_hash_value': MULTIHASH1,
|
||||
}
|
||||
six.assertRaisesRegex(self,
|
||||
self.assertRaisesRegex(
|
||||
webob.exc.HTTPConflict,
|
||||
'os_hash_algo must be sha512',
|
||||
self.controller.update,
|
||||
@ -2560,10 +2558,9 @@ class TestImagesController(base.IsolatedUnitTest):
|
||||
'os_hash_algo': 'sha512',
|
||||
'os_hash_value': 'not a hex value',
|
||||
}
|
||||
six.assertRaisesRegex(self,
|
||||
self.assertRaisesRegex(
|
||||
webob.exc.HTTPConflict,
|
||||
'os_hash_value .* is not a valid hexadecimal '
|
||||
'value',
|
||||
'os_hash_value .* is not a valid hexadecimal value',
|
||||
self.controller.update,
|
||||
request, image_id, changes)
|
||||
|
||||
@ -2572,10 +2569,9 @@ class TestImagesController(base.IsolatedUnitTest):
|
||||
'os_hash_algo': 'sha512',
|
||||
'os_hash_value': '0123456789abcdef',
|
||||
}
|
||||
six.assertRaisesRegex(self,
|
||||
self.assertRaisesRegex(
|
||||
webob.exc.HTTPConflict,
|
||||
'os_hash_value .* is not the correct size '
|
||||
'for sha512',
|
||||
'os_hash_value .* is not the correct size for sha512',
|
||||
self.controller.update,
|
||||
request, image_id, changes)
|
||||
|
||||
@ -2658,7 +2654,7 @@ class TestImagesController(base.IsolatedUnitTest):
|
||||
'os_hash_value': MULTIHASH2}}
|
||||
changes = [{'op': 'add', 'path': ['locations', '-'],
|
||||
'value': new_location}]
|
||||
six.assertRaisesRegex(self,
|
||||
self.assertRaisesRegex(
|
||||
webob.exc.HTTPConflict,
|
||||
"already set with a different value",
|
||||
self.controller.update,
|
||||
@ -4170,7 +4166,7 @@ class TestImagesDeserializer(test_utils.BaseTestCase):
|
||||
'bogus_key': 'bogus_value',
|
||||
}
|
||||
request.body = jsonutils.dump_as_bytes(changes)
|
||||
six.assertRaisesRegex(self,
|
||||
self.assertRaisesRegex(
|
||||
webob.exc.HTTPBadRequest,
|
||||
'Additional properties are not allowed',
|
||||
self.deserializer.update, request)
|
||||
@ -4179,7 +4175,7 @@ class TestImagesDeserializer(test_utils.BaseTestCase):
|
||||
'checksum': CHKSUM,
|
||||
}
|
||||
request.body = jsonutils.dump_as_bytes(changes)
|
||||
six.assertRaisesRegex(self,
|
||||
self.assertRaisesRegex(
|
||||
webob.exc.HTTPBadRequest,
|
||||
'os_hash.* is a required property',
|
||||
self.deserializer.update, request)
|
||||
|
Loading…
Reference in New Issue
Block a user