Fix Policy action "get_flavors" not found

The "get_flavors" policy has been removed since the Neutron uses policy
in code.
Patrole should test against the "get_flavor" policy and use the
"override_role_and_validate_list" function for validation.

Change-Id: Ibbe4e7e3dec27c56d4fd8990b77910866a694a3e
This commit is contained in:
Sergey Vilgelm 2019-01-31 10:32:15 -06:00
parent 2daa5e6017
commit 7a308a0f13
No known key found for this signature in database
GPG Key ID: 08D0E2FF778887E6
1 changed files with 6 additions and 4 deletions

View File

@ -103,16 +103,18 @@ class FlavorsExtRbacTest(base.BaseNetworkExtRbacTest):
@decorators.idempotent_id('ab10bd5d-987e-4255-966f-947670ffd0fa')
@rbac_rule_validation.action(service="neutron",
rules=["get_flavors"])
rules=["get_flavor"])
def test_list_flavors(self):
"""List flavors.
RBAC test for the neutron "get_flavors" policy
RBAC test for the neutron "get_flavor" policy for "list_flavors" action
"""
flavor = self.ntp_client.create_flavor(service_type=self.service_type)
self.addCleanup(
test_utils.call_and_ignore_notfound_exc,
self.ntp_client.delete_flavor, flavor["flavor"]["id"])
with self.rbac_utils.override_role(self):
self.ntp_client.list_flavors()
with self.rbac_utils.override_role_and_validate_list(
self, admin_resource_id=flavor["flavor"]["id"]
) as ctx:
ctx.resources = self.ntp_client.list_flavors()['flavors']