Implement Plan remove Role for the OpenStack client
Change-Id: I51741dac1e118c99d7878095269dc738726b03bc
This commit is contained in:
parent
3413001b4b
commit
622802052e
@ -236,11 +236,31 @@ class RemoveManagementPlanRole(show.ShowOne):
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(RemoveManagementPlanRole, self).get_parser(prog_name)
|
||||
|
||||
parser.add_argument(
|
||||
'plan_uuid',
|
||||
help="The UUID of the plan."
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
'role_uuid',
|
||||
help="The UUID of the Role being removed from the Plan."
|
||||
)
|
||||
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.log.debug("take_action(%s)" % parsed_args)
|
||||
|
||||
client = self.app.client_manager.management
|
||||
|
||||
plan = client.plans.remove_role(
|
||||
parsed_args.plan_uuid,
|
||||
parsed_args.role_uuid
|
||||
)
|
||||
|
||||
return self.dict2columns(plan.to_dict())
|
||||
|
||||
|
||||
class DownloadManagementPlan(command.Command):
|
||||
"""Download the a Management Plan."""
|
||||
|
@ -286,12 +286,23 @@ class TestRemoveManagementPlanRole(TestPlans):
|
||||
self.cmd = plan.RemoveManagementPlanRole(self.app, None)
|
||||
|
||||
def test_remove_plan_role(self):
|
||||
arglist = []
|
||||
verifylist = []
|
||||
arglist = ['UUID1', 'UUID2']
|
||||
verifylist = [
|
||||
('plan_uuid', 'UUID1'),
|
||||
('role_uuid', 'UUID2'),
|
||||
]
|
||||
|
||||
self.management_mock.plans.remove_role.return_value = (
|
||||
fakes.mock_plans[0])
|
||||
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
self.cmd.take_action(parsed_args)
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.assertEqual([
|
||||
('description', 'name', 'roles', 'uuid'),
|
||||
('Plan 1', 'Plan 1 Name', fakes.mock_roles, 'UUID1')
|
||||
], list(result))
|
||||
|
||||
|
||||
class TestDownloadManagementPlan(TestPlans):
|
||||
|
Loading…
x
Reference in New Issue
Block a user