Merge "Add response assertions and remove unused variables in volume tests"
This commit is contained in:
commit
479863dd47
@ -155,7 +155,7 @@ class BaseVolumeQuotasAdminTestJSON(base.BaseVolumeAdminTest):
|
||||
|
||||
# Accepts a volume transfer
|
||||
self.alt_transfer_client.accept_volume_transfer(
|
||||
transfer_id, auth_key=auth_key)['transfer']
|
||||
transfer_id, auth_key=auth_key)
|
||||
|
||||
# Verify volume transferred is available
|
||||
waiters.wait_for_volume_resource_status(
|
||||
|
@ -55,6 +55,7 @@ class SnapshotMetadataTestJSON(base.BaseVolumeTest):
|
||||
# Create metadata
|
||||
body = self.snapshots_client.create_snapshot_metadata(
|
||||
self.snapshot['id'], metadata)['metadata']
|
||||
self.assertThat(body.items(), matchers.ContainsAll(metadata.items()))
|
||||
|
||||
# Get the metadata of the snapshot
|
||||
body = self.snapshots_client.show_snapshot_metadata(
|
||||
@ -65,6 +66,7 @@ class SnapshotMetadataTestJSON(base.BaseVolumeTest):
|
||||
# Update metadata
|
||||
body = self.snapshots_client.update_snapshot_metadata(
|
||||
self.snapshot['id'], metadata=update)['metadata']
|
||||
self.assertEqual(update, body)
|
||||
body = self.snapshots_client.show_snapshot_metadata(
|
||||
self.snapshot['id'])['metadata']
|
||||
self.assertEqual(update, body, 'Update snapshot metadata failed')
|
||||
@ -89,8 +91,8 @@ class SnapshotMetadataTestJSON(base.BaseVolumeTest):
|
||||
"key2": "value2",
|
||||
"key3": "value3_update"}
|
||||
# Create metadata for the snapshot
|
||||
body = self.snapshots_client.create_snapshot_metadata(
|
||||
self.snapshot['id'], metadata)['metadata']
|
||||
self.snapshots_client.create_snapshot_metadata(
|
||||
self.snapshot['id'], metadata)
|
||||
# Get the metadata of the snapshot
|
||||
body = self.snapshots_client.show_snapshot_metadata(
|
||||
self.snapshot['id'])['metadata']
|
||||
@ -98,6 +100,7 @@ class SnapshotMetadataTestJSON(base.BaseVolumeTest):
|
||||
# Update metadata item
|
||||
body = self.snapshots_client.update_snapshot_metadata_item(
|
||||
self.snapshot['id'], "key3", meta=update_item)['meta']
|
||||
self.assertEqual(update_item, body)
|
||||
# Get the metadata of the snapshot
|
||||
body = self.snapshots_client.show_snapshot_metadata(
|
||||
self.snapshot['id'])['metadata']
|
||||
|
@ -45,6 +45,7 @@ class VolumesMetadataTest(base.BaseVolumeTest):
|
||||
|
||||
body = self.volumes_client.create_volume_metadata(self.volume['id'],
|
||||
metadata)['metadata']
|
||||
self.assertThat(body.items(), matchers.ContainsAll(metadata.items()))
|
||||
# Get the metadata of the volume
|
||||
body = self.volumes_client.show_volume_metadata(
|
||||
self.volume['id'])['metadata']
|
||||
@ -54,6 +55,7 @@ class VolumesMetadataTest(base.BaseVolumeTest):
|
||||
# Update metadata
|
||||
body = self.volumes_client.update_volume_metadata(
|
||||
self.volume['id'], update)['metadata']
|
||||
self.assertEqual(update, body)
|
||||
body = self.volumes_client.show_volume_metadata(
|
||||
self.volume['id'])['metadata']
|
||||
self.assertEqual(update, body, 'Update metadata failed')
|
||||
@ -85,6 +87,7 @@ class VolumesMetadataTest(base.BaseVolumeTest):
|
||||
# Update metadata item
|
||||
body = self.volumes_client.update_volume_metadata_item(
|
||||
self.volume['id'], "key3", update_item)['meta']
|
||||
self.assertEqual(update_item, body)
|
||||
# Get the metadata of the volume
|
||||
body = self.volumes_client.show_volume_metadata(
|
||||
self.volume['id'])['metadata']
|
||||
|
@ -59,6 +59,8 @@ class VolumesTransfersTest(base.BaseVolumeTest):
|
||||
# Accept a volume transfer by alt_tenant
|
||||
body = self.alt_client.accept_volume_transfer(
|
||||
transfer_id, auth_key=auth_key)['transfer']
|
||||
for key in ['id', 'name', 'links', 'volume_id']:
|
||||
self.assertIn(key, body)
|
||||
waiters.wait_for_volume_resource_status(self.alt_volumes_client,
|
||||
volume['id'], 'available')
|
||||
accepted_volume = self.alt_volumes_client.show_volume(
|
||||
|
@ -115,12 +115,12 @@ class VolumesActionsTest(base.BaseVolumeTest):
|
||||
@decorators.idempotent_id('92c4ef64-51b2-40c0-9f7e-4749fbaaba33')
|
||||
def test_reserve_unreserve_volume(self):
|
||||
# Mark volume as reserved.
|
||||
body = self.volumes_client.reserve_volume(self.volume['id'])
|
||||
self.volumes_client.reserve_volume(self.volume['id'])
|
||||
# To get the volume info
|
||||
body = self.volumes_client.show_volume(self.volume['id'])['volume']
|
||||
self.assertIn('attaching', body['status'])
|
||||
# Unmark volume as reserved.
|
||||
body = self.volumes_client.unreserve_volume(self.volume['id'])
|
||||
self.volumes_client.unreserve_volume(self.volume['id'])
|
||||
# To get the volume info
|
||||
body = self.volumes_client.show_volume(self.volume['id'])['volume']
|
||||
self.assertIn('available', body['status'])
|
||||
|
Loading…
Reference in New Issue
Block a user