Merge "Fix insert and remove rule from firewall policy"
This commit is contained in:
commit
a10390c62e
@ -235,7 +235,7 @@ class FirewallPolicyInsertRule(command.Command):
|
||||
policy_id = client.find_firewall_policy(
|
||||
parsed_args.firewall_policy)['id']
|
||||
body = self.args2body(parsed_args)
|
||||
client.insert_rule_into_policy(policy_id, body)
|
||||
client.insert_rule_into_policy(policy_id, **body)
|
||||
rule_id = body['firewall_rule_id']
|
||||
policy = parsed_args.firewall_policy
|
||||
print((_('Inserted firewall rule %(rule)s in firewall policy '
|
||||
@ -264,7 +264,7 @@ class FirewallPolicyRemoveRule(command.Command):
|
||||
parsed_args.firewall_policy)['id']
|
||||
fwr_id = _get_required_firewall_rule(client, parsed_args)
|
||||
body = {'firewall_rule_id': fwr_id}
|
||||
client.remove_rule_from_policy(policy_id, body)
|
||||
client.remove_rule_from_policy(policy_id, **body)
|
||||
rule_id = body['firewall_rule_id']
|
||||
policy = parsed_args.firewall_policy
|
||||
print((_('Removed firewall rule %(rule)s from firewall policy '
|
||||
|
@ -507,12 +507,12 @@ class TestFirewallPolicyInsertRule(TestFirewallPolicy):
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.mocked.assert_called_once_with(
|
||||
target, {
|
||||
'firewall_rule_id': rule,
|
||||
'insert_before': before,
|
||||
'insert_after': after
|
||||
})
|
||||
body = {
|
||||
'firewall_rule_id': rule,
|
||||
'insert_before': before,
|
||||
'insert_after': after
|
||||
}
|
||||
self.mocked.assert_called_once_with(target, **body)
|
||||
self.assertIsNone(result)
|
||||
self.assertEqual(1, self.networkclient.find_firewall_policy.call_count)
|
||||
self.assertEqual(3, self.networkclient.find_firewall_rule.call_count)
|
||||
@ -560,8 +560,8 @@ class TestFirewallPolicyRemoveRule(TestFirewallPolicy):
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
self.mocked.assert_called_once_with(
|
||||
target, {'firewall_rule_id': rule})
|
||||
body = {'firewall_rule_id': rule}
|
||||
self.mocked.assert_called_once_with(target, **body)
|
||||
self.assertIsNone(result)
|
||||
self.assertEqual(1, self.networkclient.find_firewall_policy.call_count)
|
||||
self.assertEqual(1, self.networkclient.find_firewall_rule.call_count)
|
||||
|
Loading…
Reference in New Issue
Block a user