Add RBAC test for listing snapshots with details
This is to add a test for listing snapshots with details
which enforces policy volume:get_all_snapshots [0].
[0] https://github.com/openstack/cinder/blob/831665f59a0d87f2dbf7fa4f7496305977a98b0f/cinder/policies/snapshots.py#L42
Change-Id: I081a39bb890e0937da1cad8fb612634b9c3e42a2
diff --git a/patrole_tempest_plugin/tests/api/volume/test_volumes_snapshots_rbac.py b/patrole_tempest_plugin/tests/api/volume/test_volumes_snapshots_rbac.py
index df4fd10..5553292 100644
--- a/patrole_tempest_plugin/tests/api/volume/test_volumes_snapshots_rbac.py
+++ b/patrole_tempest_plugin/tests/api/volume/test_volumes_snapshots_rbac.py
@@ -63,8 +63,8 @@
def test_snapshot_get(self):
# Get the snapshot
with self.rbac_utils.override_role(self):
- self.snapshots_client.show_snapshot(self.snapshot
- ['id'])['snapshot']
+ self.snapshots_client.show_snapshot(
+ self.snapshot['id'])['snapshot']
@rbac_rule_validation.action(service="cinder",
rule="volume:update_snapshot")
@@ -80,16 +80,6 @@
self.snapshots_client, self.snapshot['id'], 'available')
@rbac_rule_validation.action(service="cinder",
- rule="volume:get_all_snapshots")
- @decorators.idempotent_id('e4edf0c0-2cd3-420f-b8ab-4d98a0718608')
- def test_snapshots_get_all(self):
- """list snapshots with params."""
- # Verify list snapshots by display_name filter
- params = {'name': self.snapshot['name']}
- with self.rbac_utils.override_role(self):
- self._list_by_param_values(params)
-
- @rbac_rule_validation.action(service="cinder",
rule="volume:delete_snapshot")
@decorators.idempotent_id('c7fe54ec-3b70-4772-ba11-f166d95888a3')
def test_snapshot_delete(self):
@@ -100,3 +90,23 @@
self.snapshots_client.delete_snapshot(temp_snapshot['id'])
self.snapshots_client.wait_for_resource_deletion(
temp_snapshot['id'])
+
+ @rbac_rule_validation.action(service="cinder",
+ rule="volume:get_all_snapshots")
+ @decorators.idempotent_id('e4edf0c0-2cd3-420f-b8ab-4d98a0718608')
+ def test_list_snapshots(self):
+ """List snapshots with params."""
+ # Verify list snapshots by display_name filter
+ params = {'name': self.snapshot['name']}
+ with self.rbac_utils.override_role(self):
+ self._list_by_param_values(params)
+
+ @decorators.idempotent_id('f3155d8e-45ee-45c9-910d-18c0242229e1')
+ @rbac_rule_validation.action(service="cinder",
+ rule="volume:get_all_snapshots")
+ def test_list_snapshots_details(self):
+ """List snapshots details with params."""
+ # Verify list snapshots by display_name filter
+ params = {'name': self.snapshot['name']}
+ with self.rbac_utils.override_role(self):
+ self._list_by_param_values(params, with_detail=True)