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