commit | 2ee0db0726f80ffe0c29a5b24c91c06b988612b9 | [log] [tgz] |
---|---|---|
author | Felipe Monteiro <felipe.monteiro@att.com> | Sun Jul 08 22:19:05 2018 -0400 |
committer | Felipe Monteiro <felipe.monteiro@att.com> | Fri Jul 27 00:29:31 2018 -0400 |
tree | 80c509f35e7c6ee9f2c8d1c784f11a9aaa1ae7a4 | |
parent | 05a73499ce2eabb1f68013304d23ae09e38ba29c [diff] |
Add list backups with details for backup:backup_project_attribute This patchset adds an RBAC test for validating that "backup:backup_project_attribute" is included in response body for listing backups with details following successful policy authorization. The policy in code documentation indicates that this API enforces this policy [0] and the policy is enforced in the code here [1]. The expected attribute comes from [2]. [0] https://github.com/openstack/cinder/blob/8f7bc140052091d141e2cf436e989aa2d15dd6f4/cinder/api/v3/backups.py#L89 [1] https://github.com/openstack/cinder/blob/8f7bc140052091d141e2cf436e989aa2d15dd6f4/cinder/policies/backups.py#L57 [2] https://github.com/openstack/cinder/blob/8f7bc140052091d141e2cf436e989aa2d15dd6f4/cinder/api/v3/backups.py#L64 Change-Id: I8285b25b97de90e1911adf5e97ffd051d10adf90
diff --git a/patrole_tempest_plugin/tests/api/volume/test_volumes_backup_rbac.py b/patrole_tempest_plugin/tests/api/volume/test_volumes_backup_rbac.py index 5aff7a9..1e0a17d 100644 --- a/patrole_tempest_plugin/tests/api/volume/test_volumes_backup_rbac.py +++ b/patrole_tempest_plugin/tests/api/volume/test_volumes_backup_rbac.py
@@ -176,6 +176,11 @@ class VolumesBackupsV318RbacTest(rbac_base.BaseVolumeRbacTest): + """Validates that the ``GET /backups/{backup_id}`` and + ``GET /backups/details`` APIs inject the expected attribute + 'os-backup-project-attr:project_id' into the response body following + successful authorization. + """ _api_version = 3 # The minimum microversion for showing 'os-backup-project-attr:project_id' # is 3.18. @@ -208,6 +213,17 @@ raise rbac_exceptions.RbacMalformedResponse( attribute=self.expected_attr) + @decorators.idempotent_id('aa40b7c0-5974-48be-8cbc-e23cc61c4c68') + @rbac_rule_validation.action(service="cinder", + rule="backup:backup_project_attribute") + def test_list_backup_details_project_attribute(self): + with self.rbac_utils.override_role(self): + body = self.backups_client.list_backups(detail=True)['backups'] + + if self.expected_attr not in body[0]: + raise rbac_exceptions.RbacMalformedResponse( + attribute=self.expected_attr) + class VolumesBackupsV39RbacTest(rbac_base.BaseVolumeRbacTest): _api_version = 3