Merge "FUP: add missing test for PUT volume attachments API"
This commit is contained in:
commit
aaa3803807
|
@ -96,8 +96,9 @@ del update_volume_attachment['properties']['volumeAttachment'][
|
||||||
'properties']['device']
|
'properties']['device']
|
||||||
|
|
||||||
# NOTE(brinzhang): Allow attachment_id, serverId, device, tag, and
|
# NOTE(brinzhang): Allow attachment_id, serverId, device, tag, and
|
||||||
# delete_on_termination to be specified for RESTfulness, even though
|
# delete_on_termination (i.e., follow the content of the GET response)
|
||||||
# we will not allow updating all of them.
|
# to be specified for RESTfulness, even though we will not allow updating
|
||||||
|
# all of them.
|
||||||
update_volume_attachment_v285 = {
|
update_volume_attachment_v285 = {
|
||||||
'type': 'object',
|
'type': 'object',
|
||||||
'properties': {
|
'properties': {
|
||||||
|
|
|
@ -1384,6 +1384,22 @@ class UpdateVolumeAttachTests(VolumeAttachTestsV279):
|
||||||
self.req, FAKE_UUID,
|
self.req, FAKE_UUID,
|
||||||
FAKE_UUID_A, body=body)
|
FAKE_UUID_A, body=body)
|
||||||
|
|
||||||
|
@mock.patch.object(objects.BlockDeviceMapping,
|
||||||
|
'get_by_volume_and_instance')
|
||||||
|
def test_update_volume_with_changed_attachment_id_old_microversion(
|
||||||
|
self, mock_get_vol_and_inst):
|
||||||
|
body = {'volumeAttachment': {
|
||||||
|
'volumeId': FAKE_UUID_A,
|
||||||
|
'id': uuids.attachment_id,
|
||||||
|
}}
|
||||||
|
req = self._get_req(body, microversion='2.84')
|
||||||
|
ex = self.assertRaises(exception.ValidationError,
|
||||||
|
self.attachments.update,
|
||||||
|
req, FAKE_UUID,
|
||||||
|
FAKE_UUID_A, body=body)
|
||||||
|
self.assertIn('Additional properties are not allowed',
|
||||||
|
six.text_type(ex))
|
||||||
|
|
||||||
@mock.patch.object(objects.BlockDeviceMapping,
|
@mock.patch.object(objects.BlockDeviceMapping,
|
||||||
'get_by_volume_and_instance')
|
'get_by_volume_and_instance')
|
||||||
def test_update_volume_with_changed_serverId(self,
|
def test_update_volume_with_changed_serverId(self,
|
||||||
|
@ -1411,6 +1427,22 @@ class UpdateVolumeAttachTests(VolumeAttachTestsV279):
|
||||||
self.req, FAKE_UUID,
|
self.req, FAKE_UUID,
|
||||||
FAKE_UUID_A, body=body)
|
FAKE_UUID_A, body=body)
|
||||||
|
|
||||||
|
@mock.patch.object(objects.BlockDeviceMapping,
|
||||||
|
'get_by_volume_and_instance')
|
||||||
|
def test_update_volume_with_changed_serverId_old_microversion(
|
||||||
|
self, mock_get_vol_and_inst):
|
||||||
|
body = {'volumeAttachment': {
|
||||||
|
'volumeId': FAKE_UUID_A,
|
||||||
|
'serverId': uuids.server_id,
|
||||||
|
}}
|
||||||
|
req = self._get_req(body, microversion='2.84')
|
||||||
|
ex = self.assertRaises(exception.ValidationError,
|
||||||
|
self.attachments.update,
|
||||||
|
req, FAKE_UUID,
|
||||||
|
FAKE_UUID_A, body=body)
|
||||||
|
self.assertIn('Additional properties are not allowed',
|
||||||
|
six.text_type(ex))
|
||||||
|
|
||||||
@mock.patch.object(objects.BlockDeviceMapping,
|
@mock.patch.object(objects.BlockDeviceMapping,
|
||||||
'get_by_volume_and_instance')
|
'get_by_volume_and_instance')
|
||||||
def test_update_volume_with_changed_device(self, mock_get_vol_and_inst):
|
def test_update_volume_with_changed_device(self, mock_get_vol_and_inst):
|
||||||
|
|
Loading…
Reference in New Issue