Merge "Switch unittests for BS to use v3" into feature/r1
This commit is contained in:
commit
0dddd3915b
@ -364,15 +364,9 @@ class BlockStorageCloudMixin(_normalize.Normalizer):
|
||||
description = kwargs.pop('description',
|
||||
kwargs.pop('display_description', None))
|
||||
if name:
|
||||
if self.block_storage._version_matches(2):
|
||||
kwargs['name'] = name
|
||||
else:
|
||||
kwargs['display_name'] = name
|
||||
kwargs['name'] = name
|
||||
if description:
|
||||
if self.block_storage._version_matches(2):
|
||||
kwargs['description'] = description
|
||||
else:
|
||||
kwargs['display_description'] = description
|
||||
kwargs['description'] = description
|
||||
return kwargs
|
||||
|
||||
@_utils.valid_kwargs('name', 'display_name',
|
||||
|
@ -193,11 +193,11 @@ class TestMemoryCache(base.TestCase):
|
||||
self.get_cinder_discovery_mock_dict(),
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public', append=['volumes', 'detail']),
|
||||
'volumev3', 'public', append=['volumes', 'detail']),
|
||||
json={'volumes': [fake_volume_dict]}),
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public', append=['volumes', 'detail']),
|
||||
'volumev3', 'public', append=['volumes', 'detail']),
|
||||
json={'volumes': [fake_volume_dict, fake_volume2_dict]})])
|
||||
|
||||
for a, b in zip([fake_volume_dict],
|
||||
@ -224,11 +224,11 @@ class TestMemoryCache(base.TestCase):
|
||||
self.get_cinder_discovery_mock_dict(),
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public', append=['volumes', 'detail']),
|
||||
'volumev3', 'public', append=['volumes', 'detail']),
|
||||
json={'volumes': [fake_volume_dict]}),
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public', append=['volumes', 'detail']),
|
||||
'volumev3', 'public', append=['volumes', 'detail']),
|
||||
json={'volumes': [fake_volume_dict, fake_volume2_dict]})])
|
||||
for a, b in zip([fake_volume_dict],
|
||||
self.cloud.list_volumes()):
|
||||
@ -254,40 +254,40 @@ class TestMemoryCache(base.TestCase):
|
||||
self.get_cinder_discovery_mock_dict(),
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public', append=['volumes', 'detail']),
|
||||
'volumev3', 'public', append=['volumes', 'detail']),
|
||||
json={'volumes': [fake_volb4]}),
|
||||
dict(method='POST',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public', append=['volumes']),
|
||||
'volumev3', 'public', append=['volumes']),
|
||||
json={'volume': fake_vol_creating}),
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public', append=['volumes', _id]),
|
||||
'volumev3', 'public', append=['volumes', _id]),
|
||||
json={'volume': fake_vol_creating}),
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public', append=['volumes', _id]),
|
||||
'volumev3', 'public', append=['volumes', _id]),
|
||||
json={'volume': fake_vol_avail}),
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public', append=['volumes', 'detail']),
|
||||
'volumev3', 'public', append=['volumes', 'detail']),
|
||||
json={'volumes': [fake_volb4, fake_vol_avail]}),
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public',
|
||||
'volumev3', 'public',
|
||||
append=['volumes', _id]),
|
||||
json={'volume': fake_vol_avail}),
|
||||
dict(method='DELETE',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public', append=['volumes', _id]),
|
||||
'volumev3', 'public', append=['volumes', _id]),
|
||||
json=now_deleting),
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public', append=['volumes', _id]),
|
||||
'volumev3', 'public', append=['volumes', _id]),
|
||||
status_code=404),
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public', append=['volumes', 'detail']),
|
||||
'volumev3', 'public', append=['volumes', 'detail']),
|
||||
json={'volumes': [fake_volb4, fake_vol_avail]}),
|
||||
])
|
||||
|
||||
|
@ -17,7 +17,7 @@ test_create_volume_snapshot
|
||||
Tests for the `create_volume_snapshot` command.
|
||||
"""
|
||||
|
||||
from openstack.block_storage.v2 import snapshot
|
||||
from openstack.block_storage.v3 import snapshot
|
||||
from openstack.cloud import exc
|
||||
from openstack.cloud import meta
|
||||
from openstack.tests import fakes
|
||||
@ -52,16 +52,16 @@ class TestCreateVolumeSnapshot(base.TestCase):
|
||||
self.register_uris([
|
||||
dict(method='POST',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public', append=['snapshots']),
|
||||
'volumev3', 'public', append=['snapshots']),
|
||||
json={'snapshot': build_snapshot_dict},
|
||||
validate=dict(json={
|
||||
'snapshot': {'volume_id': '1234'}})),
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url('volumev2', 'public',
|
||||
uri=self.get_mock_url('volumev3', 'public',
|
||||
append=['snapshots', snapshot_id]),
|
||||
json={'snapshot': build_snapshot_dict}),
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url('volumev2', 'public',
|
||||
uri=self.get_mock_url('volumev3', 'public',
|
||||
append=['snapshots', snapshot_id]),
|
||||
json={'snapshot': fake_snapshot_dict})])
|
||||
|
||||
@ -84,12 +84,12 @@ class TestCreateVolumeSnapshot(base.TestCase):
|
||||
self.register_uris([
|
||||
dict(method='POST',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public', append=['snapshots']),
|
||||
'volumev3', 'public', append=['snapshots']),
|
||||
json={'snapshot': build_snapshot_dict},
|
||||
validate=dict(json={
|
||||
'snapshot': {'volume_id': '1234'}})),
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url('volumev2', 'public',
|
||||
uri=self.get_mock_url('volumev3', 'public',
|
||||
append=['snapshots', snapshot_id]),
|
||||
json={'snapshot': build_snapshot_dict})])
|
||||
|
||||
@ -116,16 +116,16 @@ class TestCreateVolumeSnapshot(base.TestCase):
|
||||
self.register_uris([
|
||||
dict(method='POST',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public', append=['snapshots']),
|
||||
'volumev3', 'public', append=['snapshots']),
|
||||
json={'snapshot': build_snapshot_dict},
|
||||
validate=dict(json={
|
||||
'snapshot': {'volume_id': '1234'}})),
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url('volumev2', 'public',
|
||||
uri=self.get_mock_url('volumev3', 'public',
|
||||
append=['snapshots', snapshot_id]),
|
||||
json={'snapshot': build_snapshot_dict}),
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url('volumev2', 'public',
|
||||
uri=self.get_mock_url('volumev3', 'public',
|
||||
append=['snapshots', snapshot_id]),
|
||||
json={'snapshot': error_snapshot_dict})])
|
||||
|
||||
|
@ -41,12 +41,12 @@ class TestDeleteVolumeSnapshot(base.TestCase):
|
||||
self.register_uris([
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public',
|
||||
'volumev3', 'public',
|
||||
append=['snapshots', 'detail']),
|
||||
json={'snapshots': [fake_snapshot_dict]}),
|
||||
dict(method='DELETE',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public',
|
||||
'volumev3', 'public',
|
||||
append=['snapshots', fake_snapshot_dict['id']]))])
|
||||
|
||||
self.assertTrue(
|
||||
@ -64,12 +64,12 @@ class TestDeleteVolumeSnapshot(base.TestCase):
|
||||
self.register_uris([
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public',
|
||||
'volumev3', 'public',
|
||||
append=['snapshots', 'detail']),
|
||||
json={'snapshots': [fake_snapshot_dict]}),
|
||||
dict(method='DELETE',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public',
|
||||
'volumev3', 'public',
|
||||
append=['snapshots', fake_snapshot_dict['id']]),
|
||||
status_code=404)])
|
||||
|
||||
@ -90,16 +90,16 @@ class TestDeleteVolumeSnapshot(base.TestCase):
|
||||
self.register_uris([
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public',
|
||||
'volumev3', 'public',
|
||||
append=['snapshots', 'detail']),
|
||||
json={'snapshots': [fake_snapshot_dict]}),
|
||||
dict(method='DELETE',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public',
|
||||
'volumev3', 'public',
|
||||
append=['snapshots', fake_snapshot_dict['id']])),
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public',
|
||||
'volumev3', 'public',
|
||||
append=['snapshots', '1234']),
|
||||
json={'snapshot': fake_snapshot_dict}),
|
||||
])
|
||||
|
@ -1395,7 +1395,7 @@ class TestImageVolume(BaseTestImage):
|
||||
self.get_cinder_discovery_mock_dict(),
|
||||
dict(method='POST',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', append=['volumes', self.volume_id, 'action']),
|
||||
'volumev3', append=['volumes', self.volume_id, 'action']),
|
||||
json={'os-volume_upload_image': {'image_id': self.image_id}},
|
||||
validate=dict(json={
|
||||
u'os-volume_upload_image': {
|
||||
@ -1427,7 +1427,7 @@ class TestImageVolume(BaseTestImage):
|
||||
self.get_cinder_discovery_mock_dict(),
|
||||
dict(method='POST',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', append=['volumes', self.volume_id, 'action']),
|
||||
'volumev3', append=['volumes', self.volume_id, 'action']),
|
||||
json={'os-volume_upload_image': {'image_id': self.image_id}},
|
||||
validate=dict(json={
|
||||
u'os-volume_upload_image': {
|
||||
|
@ -134,7 +134,7 @@ class TestQuotas(base.TestCase):
|
||||
self.get_cinder_discovery_mock_dict(),
|
||||
dict(method='PUT',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public',
|
||||
'volumev3', 'public',
|
||||
append=['os-quota-sets', project.project_id]),
|
||||
json=dict(quota_set={'volumes': 1}),
|
||||
validate=dict(
|
||||
@ -151,7 +151,7 @@ class TestQuotas(base.TestCase):
|
||||
self.get_cinder_discovery_mock_dict(),
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public',
|
||||
'volumev3', 'public',
|
||||
append=['os-quota-sets', project.project_id]),
|
||||
json=dict(quota_set={'snapshots': 10, 'volumes': 20}))])
|
||||
self.cloud.get_volume_quotas(project.project_id)
|
||||
@ -164,7 +164,7 @@ class TestQuotas(base.TestCase):
|
||||
self.get_cinder_discovery_mock_dict(),
|
||||
dict(method='DELETE',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public',
|
||||
'volumev3', 'public',
|
||||
append=['os-quota-sets', project.project_id]))])
|
||||
self.cloud.delete_volume_quotas(project.project_id)
|
||||
self.assert_calls()
|
||||
|
@ -106,11 +106,11 @@ class TestVolume(base.TestCase):
|
||||
self.get_cinder_discovery_mock_dict(),
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public', append=['volumes', vol['id']]),
|
||||
'volumev3', 'public', append=['volumes', vol['id']]),
|
||||
json={'volume': volume}),
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public', append=['volumes', vol['id']]),
|
||||
'volumev3', 'public', append=['volumes', vol['id']]),
|
||||
json={'volume': attached_volume})
|
||||
])
|
||||
# defaults to wait=True
|
||||
@ -141,11 +141,11 @@ class TestVolume(base.TestCase):
|
||||
self.get_cinder_discovery_mock_dict(),
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public', append=['volumes', volume['id']]),
|
||||
'volumev3', 'public', append=['volumes', volume['id']]),
|
||||
json={'volume': errored_volume}),
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public', append=['volumes', volume['id']]),
|
||||
'volumev3', 'public', append=['volumes', volume['id']]),
|
||||
json={'volume': errored_volume})
|
||||
])
|
||||
|
||||
@ -238,7 +238,7 @@ class TestVolume(base.TestCase):
|
||||
self.get_cinder_discovery_mock_dict(),
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public', append=['volumes', 'detail']),
|
||||
'volumev3', 'public', append=['volumes', 'detail']),
|
||||
json={'volumes': [avail_volume]})])
|
||||
self.cloud.detach_volume(server, volume)
|
||||
self.assert_calls()
|
||||
@ -262,11 +262,11 @@ class TestVolume(base.TestCase):
|
||||
self.get_cinder_discovery_mock_dict(),
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public', append=['volumes', 'detail']),
|
||||
'volumev3', 'public', append=['volumes', 'detail']),
|
||||
json={'volumes': [errored_volume]}),
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public',
|
||||
'volumev3', 'public',
|
||||
append=['volumes', errored_volume['id']]),
|
||||
json={'volume': errored_volume})
|
||||
])
|
||||
@ -284,14 +284,14 @@ class TestVolume(base.TestCase):
|
||||
self.get_cinder_discovery_mock_dict(),
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public', append=['volumes', volume.id]),
|
||||
'volumev3', 'public', append=['volumes', volume.id]),
|
||||
json={'volumes': [volume]}),
|
||||
dict(method='DELETE',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public', append=['volumes', volume.id])),
|
||||
'volumev3', 'public', append=['volumes', volume.id])),
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public', append=['volumes', volume.id]),
|
||||
'volumev3', 'public', append=['volumes', volume.id]),
|
||||
status_code=404)])
|
||||
self.assertTrue(self.cloud.delete_volume(volume['id']))
|
||||
self.assert_calls()
|
||||
@ -304,15 +304,15 @@ class TestVolume(base.TestCase):
|
||||
self.get_cinder_discovery_mock_dict(),
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public', append=['volumes', volume.id]),
|
||||
'volumev3', 'public', append=['volumes', volume.id]),
|
||||
json=volume),
|
||||
dict(method='DELETE',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public', append=['volumes', volume.id]),
|
||||
'volumev3', 'public', append=['volumes', volume.id]),
|
||||
status_code=404),
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public', append=['volumes', volume.id]),
|
||||
'volumev3', 'public', append=['volumes', volume.id]),
|
||||
status_code=404),
|
||||
])
|
||||
self.assertTrue(self.cloud.delete_volume(volume['id']))
|
||||
@ -326,17 +326,17 @@ class TestVolume(base.TestCase):
|
||||
self.get_cinder_discovery_mock_dict(),
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public', append=['volumes', volume['id']]),
|
||||
'volumev3', 'public', append=['volumes', volume['id']]),
|
||||
json={'volumes': [volume]}),
|
||||
dict(method='POST',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public',
|
||||
'volumev3', 'public',
|
||||
append=['volumes', volume.id, 'action']),
|
||||
validate=dict(
|
||||
json={'os-force_delete': {}})),
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public', append=['volumes', volume['id']]),
|
||||
'volumev3', 'public', append=['volumes', volume['id']]),
|
||||
status_code=404)])
|
||||
self.assertTrue(self.cloud.delete_volume(volume['id'], force=True))
|
||||
self.assert_calls()
|
||||
@ -349,11 +349,11 @@ class TestVolume(base.TestCase):
|
||||
self.get_cinder_discovery_mock_dict(),
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public', append=['volumes', 'detail']),
|
||||
'volumev3', 'public', append=['volumes', 'detail']),
|
||||
json={'volumes': [volume]}),
|
||||
dict(method='POST',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public',
|
||||
'volumev3', 'public',
|
||||
append=['volumes', volume.id, 'action']),
|
||||
json={'os-set_bootable': {'bootable': True}}),
|
||||
])
|
||||
@ -368,11 +368,11 @@ class TestVolume(base.TestCase):
|
||||
self.get_cinder_discovery_mock_dict(),
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public', append=['volumes', 'detail']),
|
||||
'volumev3', 'public', append=['volumes', 'detail']),
|
||||
json={'volumes': [volume]}),
|
||||
dict(method='POST',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public',
|
||||
'volumev3', 'public',
|
||||
append=['volumes', volume.id, 'action']),
|
||||
json={'os-set_bootable': {'bootable': False}}),
|
||||
])
|
||||
@ -385,7 +385,7 @@ class TestVolume(base.TestCase):
|
||||
self.get_cinder_discovery_mock_dict(),
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public',
|
||||
'volumev3', 'public',
|
||||
append=['volumes', '01']),
|
||||
json={'volume': vol1}
|
||||
)
|
||||
@ -399,7 +399,7 @@ class TestVolume(base.TestCase):
|
||||
self.get_cinder_discovery_mock_dict(),
|
||||
dict(method='POST',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public', append=['volumes']),
|
||||
'volumev3', 'public', append=['volumes']),
|
||||
json={'volume': vol1},
|
||||
validate=dict(json={
|
||||
'volume': {
|
||||
@ -417,7 +417,7 @@ class TestVolume(base.TestCase):
|
||||
self.get_cinder_discovery_mock_dict(),
|
||||
dict(method='POST',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public', append=['volumes']),
|
||||
'volumev3', 'public', append=['volumes']),
|
||||
json={'volume': vol1},
|
||||
validate=dict(json={
|
||||
'volume': {
|
||||
@ -426,7 +426,7 @@ class TestVolume(base.TestCase):
|
||||
}})),
|
||||
dict(method='POST',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public',
|
||||
'volumev3', 'public',
|
||||
append=['volumes', '01', 'action']),
|
||||
validate=dict(
|
||||
json={'os-set_bootable': {'bootable': True}})),
|
||||
|
@ -31,7 +31,7 @@ class TestVolumeAccess(base.TestCase):
|
||||
self.register_uris([
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public',
|
||||
'volumev3', 'public',
|
||||
append=['types']),
|
||||
json={'volume_types': [volume_type]})])
|
||||
self.assertTrue(self.cloud.list_volume_types())
|
||||
@ -44,7 +44,7 @@ class TestVolumeAccess(base.TestCase):
|
||||
self.register_uris([
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public',
|
||||
'volumev3', 'public',
|
||||
append=['types']),
|
||||
json={'volume_types': [volume_type]})])
|
||||
volume_type_got = self.cloud.get_volume_type(volume_type['name'])
|
||||
@ -61,12 +61,12 @@ class TestVolumeAccess(base.TestCase):
|
||||
self.register_uris([
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public',
|
||||
'volumev3', 'public',
|
||||
append=['types']),
|
||||
json={'volume_types': [volume_type]}),
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public',
|
||||
'volumev3', 'public',
|
||||
append=['types', volume_type['id'],
|
||||
'os-volume-type-access']),
|
||||
json={'volume_type_access': volume_type_access})])
|
||||
@ -86,23 +86,23 @@ class TestVolumeAccess(base.TestCase):
|
||||
self.register_uris([
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public',
|
||||
'volumev3', 'public',
|
||||
append=['types']),
|
||||
json={'volume_types': [volume_type]}),
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public',
|
||||
'volumev3', 'public',
|
||||
append=['types', volume_type['id'],
|
||||
'os-volume-type-access']),
|
||||
json={'volume_type_access': volume_type_access}),
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public',
|
||||
'volumev3', 'public',
|
||||
append=['types']),
|
||||
json={'volume_types': [volume_type]}),
|
||||
dict(method='POST',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public',
|
||||
'volumev3', 'public',
|
||||
append=['types', volume_type['id'], 'action']),
|
||||
json={'removeProjectAccess': {
|
||||
'project': project_001['project_id']}},
|
||||
@ -111,12 +111,12 @@ class TestVolumeAccess(base.TestCase):
|
||||
'project': project_001['project_id']}})),
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public',
|
||||
'volumev3', 'public',
|
||||
append=['types']),
|
||||
json={'volume_types': [volume_type]}),
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public',
|
||||
'volumev3', 'public',
|
||||
append=['types', volume_type['id'],
|
||||
'os-volume-type-access']),
|
||||
json={'volume_type_access': [project_001]})])
|
||||
@ -141,12 +141,12 @@ class TestVolumeAccess(base.TestCase):
|
||||
self.register_uris([
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public',
|
||||
'volumev3', 'public',
|
||||
append=['types']),
|
||||
json={'volume_types': [volume_type]}),
|
||||
dict(method='POST',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public',
|
||||
'volumev3', 'public',
|
||||
append=['types', volume_type['id'], 'action']),
|
||||
json={'addProjectAccess': {
|
||||
'project': project_002['project_id']}},
|
||||
@ -155,12 +155,12 @@ class TestVolumeAccess(base.TestCase):
|
||||
'project': project_002['project_id']}})),
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public',
|
||||
'volumev3', 'public',
|
||||
append=['types']),
|
||||
json={'volume_types': [volume_type]}),
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public',
|
||||
'volumev3', 'public',
|
||||
append=['types', volume_type['id'],
|
||||
'os-volume-type-access']),
|
||||
json={'volume_type_access': volume_type_access})])
|
||||
@ -179,7 +179,7 @@ class TestVolumeAccess(base.TestCase):
|
||||
self.register_uris([
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public',
|
||||
'volumev3', 'public',
|
||||
append=['types']),
|
||||
json={'volume_types': [volume_type]})])
|
||||
with testtools.ExpectedException(
|
||||
|
@ -9,7 +9,7 @@
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
from openstack.block_storage.v2 import backup
|
||||
from openstack.block_storage.v3 import backup
|
||||
from openstack.tests.unit import base
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@ class TestVolumeBackups(base.TestCase):
|
||||
self.register_uris([
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public', append=['backups', 'detail']),
|
||||
'volumev3', 'public', append=['backups', 'detail']),
|
||||
json={"backups": [vol1, vol2, vol3]})])
|
||||
result = self.cloud.search_volume_backups(
|
||||
name, {'availability_zone': 'az1'})
|
||||
@ -48,7 +48,7 @@ class TestVolumeBackups(base.TestCase):
|
||||
self.register_uris([
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public', append=['backups', 'detail']),
|
||||
'volumev3', 'public', append=['backups', 'detail']),
|
||||
json={"backups": [vol1, vol2, vol3]})])
|
||||
result = self.cloud.get_volume_backup(
|
||||
name, {'availability_zone': 'az1'})
|
||||
@ -62,7 +62,7 @@ class TestVolumeBackups(base.TestCase):
|
||||
self.register_uris([
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public', append=['backups', 'detail'],
|
||||
'volumev3', 'public', append=['backups', 'detail'],
|
||||
qs_elements=['='.join(i) for i in search_opts.items()]),
|
||||
json={"backups": [backup]})])
|
||||
result = self.cloud.list_volume_backups(True, search_opts)
|
||||
@ -77,21 +77,21 @@ class TestVolumeBackups(base.TestCase):
|
||||
self.register_uris([
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public',
|
||||
'volumev3', 'public',
|
||||
append=['backups', 'detail']),
|
||||
json={"backups": [backup]}),
|
||||
dict(method='DELETE',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public',
|
||||
'volumev3', 'public',
|
||||
append=['backups', backup_id])),
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public',
|
||||
'volumev3', 'public',
|
||||
append=['backups', backup_id]),
|
||||
json={"backup": backup}),
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public',
|
||||
'volumev3', 'public',
|
||||
append=['backups', backup_id]),
|
||||
status_code=404)])
|
||||
self.cloud.delete_volume_backup(backup_id, False, True, 1)
|
||||
@ -103,23 +103,23 @@ class TestVolumeBackups(base.TestCase):
|
||||
self.register_uris([
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public',
|
||||
'volumev3', 'public',
|
||||
append=['backups', 'detail']),
|
||||
json={"backups": [backup]}),
|
||||
dict(method='POST',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public',
|
||||
'volumev3', 'public',
|
||||
append=['backups', backup_id, 'action']),
|
||||
json={'os-force_delete': {}},
|
||||
validate=dict(json={u'os-force_delete': {}})),
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public',
|
||||
'volumev3', 'public',
|
||||
append=['backups', backup_id]),
|
||||
json={"backup": backup}),
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public',
|
||||
'volumev3', 'public',
|
||||
append=['backups', backup_id]),
|
||||
status_code=404)
|
||||
])
|
||||
@ -139,7 +139,7 @@ class TestVolumeBackups(base.TestCase):
|
||||
self.register_uris([
|
||||
dict(method='POST',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public',
|
||||
'volumev3', 'public',
|
||||
append=['backups']),
|
||||
json={'backup': bak1},
|
||||
validate=dict(json={
|
||||
@ -169,7 +169,7 @@ class TestVolumeBackups(base.TestCase):
|
||||
self.register_uris([
|
||||
dict(method='POST',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public',
|
||||
'volumev3', 'public',
|
||||
append=['backups']),
|
||||
json={'backup': bak1},
|
||||
validate=dict(json={
|
||||
@ -201,7 +201,7 @@ class TestVolumeBackups(base.TestCase):
|
||||
self.register_uris([
|
||||
dict(method='POST',
|
||||
uri=self.get_mock_url(
|
||||
'volumev2', 'public',
|
||||
'volumev3', 'public',
|
||||
append=['backups']),
|
||||
json={'backup': bak1},
|
||||
validate=dict(json={
|
||||
|
@ -10,19 +10,19 @@
|
||||
"rel": "describedby"
|
||||
},
|
||||
{
|
||||
"href": "https://volume.example.com/v2/",
|
||||
"href": "https://volume.example.com/v3/",
|
||||
"rel": "self"
|
||||
}
|
||||
],
|
||||
"min_version": "",
|
||||
"version": "",
|
||||
"min_version": "3.0",
|
||||
"version": "3.0",
|
||||
"media-types": [
|
||||
{
|
||||
"base": "application/json",
|
||||
"type": "application/vnd.openstack.volume+json;version=2"
|
||||
"type": "application/vnd.openstack.volume+json;version=3"
|
||||
}
|
||||
],
|
||||
"id": "v2.0"
|
||||
"id": "v3.0"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ clouds:
|
||||
username: admin
|
||||
user_domain_name: default
|
||||
project_domain_name: default
|
||||
block_storage_api_version: 2
|
||||
region_name: RegionOne
|
||||
_test_cloud_v2_:
|
||||
auth:
|
||||
|
Loading…
Reference in New Issue
Block a user