Add update-snapshot test
* change method test_snapshot_create_get_list_delete for VolumesSnapshotTest
* add method update_snapshot for SnapshotsClientJSON & SnapshotsClientXML
Change-Id: I09091b5859d3b5c73042efba0ecbfd96b4f5c0ea
diff --git a/tempest/api/volume/test_volumes_snapshots.py b/tempest/api/volume/test_volumes_snapshots.py
index 0328b44..6b186e5 100644
--- a/tempest/api/volume/test_volumes_snapshots.py
+++ b/tempest/api/volume/test_volumes_snapshots.py
@@ -38,7 +38,7 @@
super(VolumesSnapshotTest, cls).tearDownClass()
@attr(type='gate')
- def test_snapshot_create_get_list_delete(self):
+ def test_snapshot_create_get_list_update_delete(self):
# Create a snapshot
s_name = rand_name('snap')
snapshot = self.create_snapshot(self.volume_origin['id'],
@@ -58,6 +58,24 @@
snaps_data = [(f['id'], f['display_name']) for f in snaps_list]
self.assertIn(tracking_data, snaps_data)
+ # Updates snapshot with new values
+ new_s_name = rand_name('new-snap')
+ new_desc = 'This is the new description of snapshot.'
+ resp, update_snapshot = \
+ self.snapshots_client.update_snapshot(snapshot['id'],
+ display_name=new_s_name,
+ display_description=new_desc)
+ # Assert response body for update_snapshot method
+ self.assertEqual(200, resp.status)
+ self.assertEqual(new_s_name, update_snapshot['display_name'])
+ self.assertEqual(new_desc, update_snapshot['display_description'])
+ # Assert response body for get_snapshot method
+ resp, updated_snapshot = \
+ self.snapshots_client.get_snapshot(snapshot['id'])
+ self.assertEqual(200, resp.status)
+ self.assertEqual(new_s_name, updated_snapshot['display_name'])
+ self.assertEqual(new_desc, updated_snapshot['display_description'])
+
# Delete the snapshot
self.snapshots_client.delete_snapshot(snapshot['id'])
self.assertEqual(200, resp.status)