RBAC tests for image_size compute policy action.

Add RBAC tests related to the ``image_size`` compute policy action:
"os_compute_api:image-size".

Note that if Patrole is enhanced to test multiple policies
simultaneously, these policy actions can be combined with the related
tests from ``ImagesRbacTest`` class in the same file.

Change-Id: Ifcf83daa61741be3d694d07b85fcd5ac6f616f46
This commit is contained in:
Felipe Monteiro 2017-05-30 21:50:06 +01:00
parent a44dddf13a
commit ace85acc1a
2 changed files with 35 additions and 0 deletions

View File

@ -178,3 +178,33 @@ class ImagesRbacTest(rbac_base.BaseV2ComputeRbacTest):
self.rbac_utils.switch_role(self, toggle_rbac_role=True)
self.compute_images_client.delete_image_metadata_item(self.image['id'],
key='foo')
class ImageSizeRbacTest(rbac_base.BaseV2ComputeRbacTest):
"""Tests the ``image_size`` compute policies.
NOTE(felipemonteiro): If Patrole is enhanced to test multiple policies
simultaneously, these policy actions can be combined with the related
tests from ``ImagesRbacTest`` above.
"""
# These tests will fail with a 404 starting from microversion 2.36.
# See the following link for details:
# https://developer.openstack.org/api-ref/compute/#images-deprecated
max_microversion = '2.35'
@decorators.idempotent_id('fe34d2a6-5743-45bf-8f92-a1d703d7c7ab')
@rbac_rule_validation.action(
service="nova",
rule="os_compute_api:image-size")
def test_list_images(self):
self.rbac_utils.switch_role(self, toggle_rbac_role=True)
self.compute_images_client.list_images()
@decorators.idempotent_id('08342c7d-297d-42ee-b398-90fce2443792')
@rbac_rule_validation.action(
service="nova",
rule="os_compute_api:image-size")
def test_list_images_with_details(self):
self.rbac_utils.switch_role(self, toggle_rbac_role=True)
self.compute_images_client.list_images(detail=True)

View File

@ -0,0 +1,5 @@
---
features:
- |
Add RBAC tests related to the ``image_size`` compute policy action:
"os_compute_api:image-size".