Fix H405 violations

There are a lot of H405 violation codes.
We need to fix the code for avoiding more violations.

Change-Id: Iaa83626b81a3d8369b16e2b4f394e2bc4628998a
Closes-Bug: #1521899
This commit is contained in:
shu-mutou 2015-12-03 15:40:14 +09:00 committed by Akihiro Motoki
parent 2d5b6e6699
commit ec4e482731
40 changed files with 462 additions and 519 deletions

View File

@ -219,7 +219,9 @@ class CommandError(NeutronCLIError):
class UnsupportedVersion(NeutronCLIError):
"""Indicates that the user is trying to use an unsupported version of
"""Indicates usage of an unsupported API version
Indicates that the user is trying to use an unsupported version of
the API.
"""
pass

View File

@ -124,8 +124,7 @@ class AssociateFloatingIP(neutronV20.NeutronCommand):
class DisassociateFloatingIP(neutronV20.NeutronCommand):
"""Remove a mapping from a floating IP to a fixed IP.
"""
"""Remove a mapping from a floating IP to a fixed IP."""
api = 'network'
resource = 'floatingip'

View File

@ -398,7 +398,9 @@ COMMANDS = {'2.0': COMMAND_V2}
class HelpAction(argparse.Action):
"""Provide a custom action so the -h and --help options
"""Print help message including sub-commands
Provide a custom action so the -h and --help options
to the main app will print a list of the commands.
The commands are determined by checking the CommandManager
@ -831,7 +833,9 @@ class NeutronShell(app.App):
return 1
def authenticate_user(self):
"""Make sure the user has provided all of the authentication
"""Confirm user authentication
Make sure the user has provided all of the authentication
info we need.
"""
cloud_config = os_client_config.OpenStackConfig().get_one_cloud(

View File

@ -15,15 +15,15 @@ from neutronclient.tests.functional import base
class SimpleReadOnlyNeutronVpnClientTest(base.ClientTestBase):
"""This is a first pass at a simple read only python-neutronclient test.
This only exercises vpn based client commands that are read only.
"""Tests for vpn based client commands that are read only
This is a first pass at a simple read only python-neutronclient test.
This only exercises vpn based client commands that are read only.
This should test commands:
* as a regular user
* as a admin user
* with and without optional parameters
* initially just check return codes, and later test command outputs
"""
def test_neutron_vpn_ikepolicy_list(self):

View File

@ -20,14 +20,13 @@ from neutronclient.tests.functional import base
class SimpleReadOnlyNeutronClientTest(base.ClientTestBase):
"""This is a first pass at a simple read only python-neutronclient test.
This only exercises client commands that are read only.
This only exercises client commands that are read only.
This should test commands:
* as a regular user
* as a admin user
* with and without optional parameters
* initially just check return codes, and later test command outputs
"""
def test_admin_fake_action(self):

View File

@ -23,7 +23,7 @@ from neutronclient.tests.unit import test_cli20
class CLITestV20FirewallJSON(test_cli20.CLITestV20Base):
def test_create_firewall_with_mandatory_params(self):
"""firewall-create with mandatory (none) params."""
# firewall-create with mandatory (none) params.
resource = 'firewall'
cmd = firewall.CreateFirewall(test_cli20.MyApp(sys.stdout), None)
name = ''
@ -38,7 +38,7 @@ class CLITestV20FirewallJSON(test_cli20.CLITestV20Base):
admin_state_up=True, tenant_id=tenant_id)
def test_create_firewall_with_all_params(self):
"""firewall-create with all params set."""
# firewall-create with all params set.
resource = 'firewall'
cmd = firewall.CreateFirewall(test_cli20.MyApp(sys.stdout), None)
name = 'my-name'
@ -72,21 +72,20 @@ class CLITestV20FirewallJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_list_firewalls(self):
"""firewall-list."""
# firewall-list.
resources = "firewalls"
cmd = firewall.ListFirewall(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd, True)
def test_list_firewalls_pagination(self):
"""firewall-list with pagination."""
# firewall-list with pagination.
resources = "firewalls"
cmd = firewall.ListFirewall(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources_with_pagination(resources, cmd)
def test_list_firewalls_sort(self):
"""sorted list: firewall-list --sort-key name --sort-key id
--sort-key asc --sort-key desc
"""
# sorted list: firewall-list --sort-key name --sort-key id
# --sort-key asc --sort-key desc
resources = "firewalls"
cmd = firewall.ListFirewall(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd,
@ -94,20 +93,20 @@ class CLITestV20FirewallJSON(test_cli20.CLITestV20Base):
sort_dir=["asc", "desc"])
def test_list_firewalls_limit(self):
"""size (1000) limited list: firewall-list -P."""
# size (1000) limited list: firewall-list -P.
resources = "firewalls"
cmd = firewall.ListFirewall(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd, page_size=1000)
def test_show_firewall_id(self):
"""firewall-show test_id."""
# firewall-show test_id.
resource = 'firewall'
cmd = firewall.ShowFirewall(test_cli20.MyApp(sys.stdout), None)
args = ['--fields', 'id', self.test_id]
self._test_show_resource(resource, cmd, self.test_id, args, ['id'])
def test_show_firewall_id_name(self):
"""firewall-show."""
# firewall-show.
resource = 'firewall'
cmd = firewall.ShowFirewall(test_cli20.MyApp(sys.stdout), None)
args = ['--fields', 'id', '--fields', 'name', self.test_id]
@ -115,7 +114,7 @@ class CLITestV20FirewallJSON(test_cli20.CLITestV20Base):
args, ['id', 'name'])
def test_update_firewall(self):
"""firewall-update myid --name newname --tags a b."""
# firewall-update myid --name newname --tags a b.
resource = 'firewall'
cmd = firewall.UpdateFirewall(test_cli20.MyApp(sys.stdout), None)
self._test_update_resource(resource, cmd, 'myid',
@ -123,7 +122,7 @@ class CLITestV20FirewallJSON(test_cli20.CLITestV20Base):
{'name': 'newname', })
def test_update_firewall_using_policy_name(self):
"""firewall-update myid --policy newpolicy."""
# firewall-update myid --policy newpolicy.
resource = 'firewall'
cmd = firewall.UpdateFirewall(test_cli20.MyApp(sys.stdout), None)
self._test_update_resource(resource, cmd, 'myid',
@ -155,7 +154,7 @@ class CLITestV20FirewallJSON(test_cli20.CLITestV20Base):
['myid', '--no-routers', '--router', 'fake-id'], {})
def test_delete_firewall(self):
"""firewall-delete my-id."""
# firewall-delete my-id.
resource = 'firewall'
cmd = firewall.DeleteFirewall(test_cli20.MyApp(sys.stdout), None)
my_id = 'my-id'

View File

@ -28,7 +28,7 @@ class CLITestV20FirewallPolicyJSON(test_cli20.CLITestV20Base):
super(CLITestV20FirewallPolicyJSON, self).setUp()
def test_create_firewall_policy_with_mandatory_params(self):
"""firewall-policy-create with mandatory (none) params only."""
# firewall-policy-create with mandatory (none) params only.
resource = 'firewall_policy'
cmd = firewallpolicy.CreateFirewallPolicy(test_cli20.MyApp(sys.stdout),
None)
@ -45,7 +45,7 @@ class CLITestV20FirewallPolicyJSON(test_cli20.CLITestV20Base):
admin_state_up=True, tenant_id=tenant_id)
def test_create_firewall_policy_with_all_params(self):
"""firewall-policy-create with rule param of misc format."""
# firewall-policy-create with rule param of misc format.
resource = 'firewall_policy'
cmd = firewallpolicy.CreateFirewallPolicy(test_cli20.MyApp(sys.stdout),
None)
@ -74,23 +74,22 @@ class CLITestV20FirewallPolicyJSON(test_cli20.CLITestV20Base):
tenant_id=tenant_id)
def test_list_firewall_policies(self):
"""firewall-policy-list."""
# firewall-policy-list.
resources = "firewall_policies"
cmd = firewallpolicy.ListFirewallPolicy(test_cli20.MyApp(sys.stdout),
None)
self._test_list_resources(resources, cmd, True)
def test_list_firewall_policies_pagination(self):
"""firewall-policy-list."""
# firewall-policy-list."""
resources = "firewall_policies"
cmd = firewallpolicy.ListFirewallPolicy(test_cli20.MyApp(sys.stdout),
None)
self._test_list_resources_with_pagination(resources, cmd)
def test_list_firewall_policies_sort(self):
"""sorted list: firewall-policy-list --sort-key name --sort-key id
--sort-key asc --sort-key desc
"""
# sorted list: firewall-policy-list --sort-key name --sort-key id
# --sort-key asc --sort-key desc
resources = "firewall_policies"
cmd = firewallpolicy.ListFirewallPolicy(test_cli20.MyApp(sys.stdout),
None)
@ -99,14 +98,14 @@ class CLITestV20FirewallPolicyJSON(test_cli20.CLITestV20Base):
sort_dir=["asc", "desc"])
def test_list_firewall_policies_limit(self):
"""size (1000) limited list: firewall-policy-list -P."""
# size (1000) limited list: firewall-policy-list -P.
resources = "firewall_policies"
cmd = firewallpolicy.ListFirewallPolicy(test_cli20.MyApp(sys.stdout),
None)
self._test_list_resources(resources, cmd, page_size=1000)
def test_show_firewall_policy_id(self):
"""firewall-policy-show test_id."""
# firewall-policy-show test_id.
resource = 'firewall_policy'
cmd = firewallpolicy.ShowFirewallPolicy(test_cli20.MyApp(sys.stdout),
None)
@ -114,7 +113,7 @@ class CLITestV20FirewallPolicyJSON(test_cli20.CLITestV20Base):
self._test_show_resource(resource, cmd, self.test_id, args, ['id'])
def test_show_firewall_policy_id_name(self):
"""firewall-policy-show."""
# firewall-policy-show.
resource = 'firewall_policy'
cmd = firewallpolicy.ShowFirewallPolicy(test_cli20.MyApp(sys.stdout),
None)
@ -123,7 +122,7 @@ class CLITestV20FirewallPolicyJSON(test_cli20.CLITestV20Base):
args, ['id', 'name'])
def test_update_firewall_policy(self):
"""firewall-policy-update myid --name newname."""
# firewall-policy-update myid --name newname.
resource = 'firewall_policy'
cmd = firewallpolicy.UpdateFirewallPolicy(test_cli20.MyApp(sys.stdout),
None)
@ -132,7 +131,7 @@ class CLITestV20FirewallPolicyJSON(test_cli20.CLITestV20Base):
{'name': 'newname', })
def test_update_firewall_policy_with_rules(self):
"""firewall-policy-update myid --firewall-rules "rule1 rule2"."""
# firewall-policy-update myid --firewall-rules "rule1 rule2".
resource = 'firewall_policy'
cmd = firewallpolicy.UpdateFirewallPolicy(test_cli20.MyApp(sys.stdout),
None)
@ -144,7 +143,7 @@ class CLITestV20FirewallPolicyJSON(test_cli20.CLITestV20Base):
{'firewall_rules': firewall_rules_res, })
def test_delete_firewall_policy(self):
"""firewall-policy-delete my-id."""
# firewall-policy-delete my-id.
resource = 'firewall_policy'
cmd = firewallpolicy.DeleteFirewallPolicy(test_cli20.MyApp(sys.stdout),
None)
@ -153,10 +152,8 @@ class CLITestV20FirewallPolicyJSON(test_cli20.CLITestV20Base):
self._test_delete_resource(resource, cmd, my_id, args)
def test_insert_firewall_rule(self):
"""firewall-policy-insert-rule myid newruleid
--insert-before ruleAid
--insert-after ruleBid
"""
# firewall-policy-insert-rule myid newruleid --insert-before ruleAid
# --insert-after ruleBid
resource = 'firewall_policy'
cmd = firewallpolicy.FirewallPolicyInsertRule(
test_cli20.MyApp(sys.stdout),
@ -189,8 +186,7 @@ class CLITestV20FirewallPolicyJSON(test_cli20.CLITestV20Base):
self.mox.UnsetStubs()
def test_remove_firewall_rule(self):
"""firewall-policy-remove-rule myid ruleid
"""
# firewall-policy-remove-rule myid ruleid
resource = 'firewall_policy'
cmd = firewallpolicy.FirewallPolicyRemoveRule(
test_cli20.MyApp(sys.stdout),

View File

@ -23,7 +23,7 @@ from neutronclient.tests.unit import test_cli20
class CLITestV20FirewallRuleJSON(test_cli20.CLITestV20Base):
def _test_create_firewall_rule_with_mandatory_params(self, enabled):
"""firewall-rule-create with mandatory (none) params only."""
# firewall-rule-create with mandatory (none) params only.
resource = 'firewall_rule'
cmd = firewallrule.CreateFirewallRule(test_cli20.MyApp(sys.stdout),
None)
@ -57,7 +57,7 @@ class CLITestV20FirewallRuleJSON(test_cli20.CLITestV20Base):
self._test_create_firewall_rule_with_mandatory_params(enabled='False')
def _setup_create_firewall_rule_with_all_params(self, protocol='tcp'):
"""firewall-rule-create with all params set."""
# firewall-rule-create with all params set.
resource = 'firewall_rule'
cmd = firewallrule.CreateFirewallRule(test_cli20.MyApp(sys.stdout),
None)
@ -104,23 +104,22 @@ class CLITestV20FirewallRuleJSON(test_cli20.CLITestV20Base):
self._setup_create_firewall_rule_with_all_params(protocol='any')
def test_list_firewall_rules(self):
"""firewall-rule-list."""
# firewall-rule-list.
resources = "firewall_rules"
cmd = firewallrule.ListFirewallRule(test_cli20.MyApp(sys.stdout),
None)
self._test_list_resources(resources, cmd, True)
def test_list_firewall_rules_pagination(self):
"""firewall-rule-list."""
# firewall-rule-list.
resources = "firewall_rules"
cmd = firewallrule.ListFirewallRule(test_cli20.MyApp(sys.stdout),
None)
self._test_list_resources_with_pagination(resources, cmd)
def test_list_firewall_rules_sort(self):
"""firewall-rule-list --sort-key name --sort-key id --sort-key asc
--sort-key desc
"""
# firewall-rule-list --sort-key name --sort-key id --sort-key asc
# --sort-key desc
resources = "firewall_rules"
cmd = firewallrule.ListFirewallRule(test_cli20.MyApp(sys.stdout),
None)
@ -129,14 +128,14 @@ class CLITestV20FirewallRuleJSON(test_cli20.CLITestV20Base):
sort_dir=["asc", "desc"])
def test_list_firewall_rules_limit(self):
"""firewall-rule-list -P."""
# firewall-rule-list -P."""
resources = "firewall_rules"
cmd = firewallrule.ListFirewallRule(test_cli20.MyApp(sys.stdout),
None)
self._test_list_resources(resources, cmd, page_size=1000)
def test_show_firewall_rule_id(self):
"""firewall-rule-show test_id."""
# firewall-rule-show test_id.
resource = 'firewall_rule'
cmd = firewallrule.ShowFirewallRule(test_cli20.MyApp(sys.stdout),
None)
@ -144,7 +143,7 @@ class CLITestV20FirewallRuleJSON(test_cli20.CLITestV20Base):
self._test_show_resource(resource, cmd, self.test_id, args, ['id'])
def test_show_firewall_rule_id_name(self):
"""firewall-rule-show."""
# firewall-rule-show.
resource = 'firewall_rule'
cmd = firewallrule.ShowFirewallRule(test_cli20.MyApp(sys.stdout),
None)
@ -153,7 +152,7 @@ class CLITestV20FirewallRuleJSON(test_cli20.CLITestV20Base):
args, ['id', 'name'])
def test_update_firewall_rule(self):
"""firewall-rule-update myid --name newname."""
# firewall-rule-update myid --name newname.
resource = 'firewall_rule'
cmd = firewallrule.UpdateFirewallRule(test_cli20.MyApp(sys.stdout),
None)
@ -162,7 +161,7 @@ class CLITestV20FirewallRuleJSON(test_cli20.CLITestV20Base):
{'name': 'newname', })
def test_update_firewall_rule_protocol(self):
"""firewall-rule-update myid --protocol any."""
# firewall-rule-update myid --protocol any.
resource = 'firewall_rule'
cmd = firewallrule.UpdateFirewallRule(test_cli20.MyApp(sys.stdout),
None)
@ -171,7 +170,7 @@ class CLITestV20FirewallRuleJSON(test_cli20.CLITestV20Base):
{'protocol': None, })
def test_delete_firewall_rule(self):
"""firewall-rule-delete my-id."""
# firewall-rule-delete my-id.
resource = 'firewall_rule'
cmd = firewallrule.DeleteFirewallRule(test_cli20.MyApp(sys.stdout),
None)

View File

@ -24,7 +24,7 @@ from neutronclient.tests.unit import test_cli20
class CLITestV20LbHealthmonitorJSON(test_cli20.CLITestV20Base):
def test_create_healthmonitor_with_mandatory_params(self):
"""lb-healthmonitor-create with mandatory params only."""
# lb-healthmonitor-create with mandatory params only.
resource = 'health_monitor'
cmd = healthmonitor.CreateHealthMonitor(test_cli20.MyApp(sys.stdout),
None)
@ -49,7 +49,7 @@ class CLITestV20LbHealthmonitorJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_create_healthmonitor_with_all_params(self):
"""lb-healthmonitor-create with all params set."""
# lb-healthmonitor-create with all params set.
resource = 'health_monitor'
cmd = healthmonitor.CreateHealthMonitor(test_cli20.MyApp(sys.stdout),
None)
@ -84,23 +84,22 @@ class CLITestV20LbHealthmonitorJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_list_healthmonitors(self):
"""lb-healthmonitor-list."""
# lb-healthmonitor-list.
resources = "health_monitors"
cmd = healthmonitor.ListHealthMonitor(test_cli20.MyApp(sys.stdout),
None)
self._test_list_resources(resources, cmd, True)
def test_list_healthmonitors_pagination(self):
"""lb-healthmonitor-list."""
# lb-healthmonitor-list.
resources = "health_monitors"
cmd = healthmonitor.ListHealthMonitor(test_cli20.MyApp(sys.stdout),
None)
self._test_list_resources_with_pagination(resources, cmd)
def test_list_healthmonitors_sort(self):
"""lb-healthmonitor-list --sort-key name --sort-key id --sort-key asc
--sort-key desc
"""
# lb-healthmonitor-list --sort-key name --sort-key id --sort-key asc
# --sort-key desc
resources = "health_monitors"
cmd = healthmonitor.ListHealthMonitor(test_cli20.MyApp(sys.stdout),
None)
@ -109,14 +108,14 @@ class CLITestV20LbHealthmonitorJSON(test_cli20.CLITestV20Base):
sort_dir=["asc", "desc"])
def test_list_healthmonitors_limit(self):
"""lb-healthmonitor-list -P."""
# lb-healthmonitor-list -P.
resources = "health_monitors"
cmd = healthmonitor.ListHealthMonitor(test_cli20.MyApp(sys.stdout),
None)
self._test_list_resources(resources, cmd, page_size=1000)
def test_show_healthmonitor_id(self):
"""lb-healthmonitor-show test_id."""
# lb-healthmonitor-show test_id.
resource = 'health_monitor'
cmd = healthmonitor.ShowHealthMonitor(test_cli20.MyApp(sys.stdout),
None)
@ -124,7 +123,7 @@ class CLITestV20LbHealthmonitorJSON(test_cli20.CLITestV20Base):
self._test_show_resource(resource, cmd, self.test_id, args, ['id'])
def test_update_health_monitor(self):
"""lb-healthmonitor-update myid --name myname --tags a b."""
# lb-healthmonitor-update myid --name myname --tags a b.
resource = 'health_monitor'
cmd = healthmonitor.UpdateHealthMonitor(test_cli20.MyApp(sys.stdout),
None)
@ -133,7 +132,7 @@ class CLITestV20LbHealthmonitorJSON(test_cli20.CLITestV20Base):
{'timeout': '5', })
def test_delete_healthmonitor(self):
"""lb-healthmonitor-delete my-id."""
# lb-healthmonitor-delete my-id."""
resource = 'health_monitor'
cmd = healthmonitor.DeleteHealthMonitor(test_cli20.MyApp(sys.stdout),
None)

View File

@ -25,7 +25,7 @@ class CLITestV20LbMemberJSON(test_cli20.CLITestV20Base):
super(CLITestV20LbMemberJSON, self).setUp(plurals={'tags': 'tag'})
def test_create_member(self):
"""lb-member-create with mandatory params only."""
# lb-member-create with mandatory params only.
resource = 'member'
cmd = member.CreateMember(test_cli20.MyApp(sys.stdout), None)
address = '10.0.0.1'
@ -43,7 +43,7 @@ class CLITestV20LbMemberJSON(test_cli20.CLITestV20Base):
admin_state_up=None)
def test_create_member_all_params(self):
"""lb-member-create with all available params."""
# lb-member-create with all available params.
resource = 'member'
cmd = member.CreateMember(test_cli20.MyApp(sys.stdout), None)
address = '10.0.0.1'
@ -67,21 +67,20 @@ class CLITestV20LbMemberJSON(test_cli20.CLITestV20Base):
admin_state_up=None)
def test_list_members(self):
"""lb-member-list."""
# lb-member-list.
resources = "members"
cmd = member.ListMember(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd, True)
def test_list_members_pagination(self):
"""lb-member-list."""
# lb-member-list.
resources = "members"
cmd = member.ListMember(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources_with_pagination(resources, cmd)
def test_list_members_sort(self):
"""lb-member-list --sort-key name --sort-key id --sort-key asc
--sort-key desc
"""
# lb-member-list --sort-key name --sort-key id --sort-key asc
# --sort-key desc
resources = "members"
cmd = member.ListMember(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd,
@ -89,20 +88,20 @@ class CLITestV20LbMemberJSON(test_cli20.CLITestV20Base):
sort_dir=["asc", "desc"])
def test_list_members_limit(self):
"""lb-member-list -P."""
# lb-member-list -P.
resources = "members"
cmd = member.ListMember(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd, page_size=1000)
def test_show_member_id(self):
"""lb-member-show test_id."""
# lb-member-show test_id.
resource = 'member'
cmd = member.ShowMember(test_cli20.MyApp(sys.stdout), None)
args = ['--fields', 'id', self.test_id]
self._test_show_resource(resource, cmd, self.test_id, args, ['id'])
def test_update_member(self):
"""lb-member-update myid --name myname --tags a b."""
# lb-member-update myid --name myname --tags a b.
resource = 'member'
cmd = member.UpdateMember(test_cli20.MyApp(sys.stdout), None)
self._test_update_resource(resource, cmd, 'myid',
@ -111,7 +110,7 @@ class CLITestV20LbMemberJSON(test_cli20.CLITestV20Base):
{'name': 'myname', 'tags': ['a', 'b'], })
def test_delete_member(self):
"""lb-member-delete my-id."""
# lb-member-delete my-id.
resource = 'member'
cmd = member.DeleteMember(test_cli20.MyApp(sys.stdout), None)
my_id = 'my-id'

View File

@ -25,7 +25,7 @@ from neutronclient.tests.unit import test_cli20
class CLITestV20LbPoolJSON(test_cli20.CLITestV20Base):
def test_create_pool_with_mandatory_params(self):
"""lb-pool-create with mandatory params only."""
# lb-pool-create with mandatory params only.
resource = 'pool'
cmd = pool.CreatePool(test_cli20.MyApp(sys.stdout), None)
name = 'my-name'
@ -47,7 +47,7 @@ class CLITestV20LbPoolJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_create_pool_with_all_params(self):
"""lb-pool-create with all params set."""
# lb-pool-create with all params set.
resource = 'pool'
cmd = pool.CreatePool(test_cli20.MyApp(sys.stdout), None)
name = 'my-name'
@ -74,21 +74,20 @@ class CLITestV20LbPoolJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_list_pools(self):
"""lb-pool-list."""
# lb-pool-list.
resources = "pools"
cmd = pool.ListPool(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd, True)
def test_list_pools_pagination(self):
"""lb-pool-list."""
# lb-pool-list.
resources = "pools"
cmd = pool.ListPool(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources_with_pagination(resources, cmd)
def test_list_pools_sort(self):
"""lb-pool-list --sort-key name --sort-key id --sort-key asc
--sort-key desc
"""
# lb-pool-list --sort-key name --sort-key id --sort-key asc
# --sort-key desc
resources = "pools"
cmd = pool.ListPool(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd,
@ -96,20 +95,20 @@ class CLITestV20LbPoolJSON(test_cli20.CLITestV20Base):
sort_dir=["asc", "desc"])
def test_list_pools_limit(self):
"""lb-pool-list -P."""
# lb-pool-list -P.
resources = "pools"
cmd = pool.ListPool(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd, page_size=1000)
def test_show_pool_id(self):
"""lb-pool-show test_id."""
# lb-pool-show test_id.
resource = 'pool'
cmd = pool.ShowPool(test_cli20.MyApp(sys.stdout), None)
args = ['--fields', 'id', self.test_id]
self._test_show_resource(resource, cmd, self.test_id, args, ['id'])
def test_show_pool_id_name(self):
"""lb-pool-show."""
# lb-pool-show.
resource = 'pool'
cmd = pool.ShowPool(test_cli20.MyApp(sys.stdout), None)
args = ['--fields', 'id', '--fields', 'name', self.test_id]
@ -117,7 +116,7 @@ class CLITestV20LbPoolJSON(test_cli20.CLITestV20Base):
args, ['id', 'name'])
def test_update_pool(self):
"""lb-pool-update myid --name newname --tags a b."""
# lb-pool-update myid --name newname --tags a b.
resource = 'pool'
cmd = pool.UpdatePool(test_cli20.MyApp(sys.stdout), None)
self._test_update_resource(resource, cmd, 'myid',
@ -125,7 +124,7 @@ class CLITestV20LbPoolJSON(test_cli20.CLITestV20Base):
{'name': 'newname', })
def test_delete_pool(self):
"""lb-pool-delete my-id."""
# lb-pool-delete my-id.
resource = 'pool'
cmd = pool.DeletePool(test_cli20.MyApp(sys.stdout), None)
my_id = 'my-id'
@ -133,7 +132,7 @@ class CLITestV20LbPoolJSON(test_cli20.CLITestV20Base):
self._test_delete_resource(resource, cmd, my_id, args)
def test_retrieve_pool_stats(self):
"""lb-pool-stats test_id."""
# lb-pool-stats test_id.
resource = 'pool'
cmd = pool.RetrievePoolStats(test_cli20.MyApp(sys.stdout), None)
my_id = self.test_id

View File

@ -25,7 +25,7 @@ class CLITestV20LbVipJSON(test_cli20.CLITestV20Base):
super(CLITestV20LbVipJSON, self).setUp(plurals={'tags': 'tag'})
def test_create_vip_with_mandatory_params(self):
"""lb-vip-create with all mandatory params."""
# lb-vip-create with all mandatory params.
resource = 'vip'
cmd = vip.CreateVip(test_cli20.MyApp(sys.stdout), None)
pool_id = 'my-pool-id'
@ -50,7 +50,7 @@ class CLITestV20LbVipJSON(test_cli20.CLITestV20Base):
admin_state_up=True)
def test_create_vip_with_all_params(self):
"""lb-vip-create with all params."""
# lb-vip-create with all params.
resource = 'vip'
cmd = vip.CreateVip(test_cli20.MyApp(sys.stdout), None)
pool_id = 'my-pool-id'
@ -86,7 +86,7 @@ class CLITestV20LbVipJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_create_vip_with_session_persistence_params(self):
"""lb-vip-create with mandatory and session-persistence params."""
# lb-vip-create with mandatory and session-persistence params.
resource = 'vip'
cmd = vip.CreateVip(test_cli20.MyApp(sys.stdout), None)
pool_id = 'my-pool-id'
@ -120,21 +120,20 @@ class CLITestV20LbVipJSON(test_cli20.CLITestV20Base):
admin_state_up=True, extra_body=extra_body)
def test_list_vips(self):
"""lb-vip-list."""
# lb-vip-list.
resources = "vips"
cmd = vip.ListVip(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd, True)
def test_list_vips_pagination(self):
"""lb-vip-list."""
# lb-vip-list.
resources = "vips"
cmd = vip.ListVip(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources_with_pagination(resources, cmd)
def test_list_vips_sort(self):
"""lb-vip-list --sort-key name --sort-key id --sort-key asc
--sort-key desc
"""
# lb-vip-list --sort-key name --sort-key id --sort-key asc
# --sort-key desc
resources = "vips"
cmd = vip.ListVip(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd,
@ -142,20 +141,20 @@ class CLITestV20LbVipJSON(test_cli20.CLITestV20Base):
sort_dir=["asc", "desc"])
def test_list_vips_limit(self):
"""lb-vip-list -P."""
# lb-vip-list -P.
resources = "vips"
cmd = vip.ListVip(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd, page_size=1000)
def test_show_vip_id(self):
"""lb-vip-show test_id."""
# lb-vip-show test_id.
resource = 'vip'
cmd = vip.ShowVip(test_cli20.MyApp(sys.stdout), None)
args = ['--fields', 'id', self.test_id]
self._test_show_resource(resource, cmd, self.test_id, args, ['id'])
def test_show_vip_id_name(self):
"""lb-vip-show."""
# lb-vip-show.
resource = 'vip'
cmd = vip.ShowVip(test_cli20.MyApp(sys.stdout), None)
args = ['--fields', 'id', '--fields', 'name', self.test_id]
@ -163,7 +162,7 @@ class CLITestV20LbVipJSON(test_cli20.CLITestV20Base):
args, ['id', 'name'])
def test_update_vip(self):
"""lb-vip-update myid --name myname --tags a b."""
# lb-vip-update myid --name myname --tags a b.
resource = 'vip'
cmd = vip.UpdateVip(test_cli20.MyApp(sys.stdout), None)
self._test_update_resource(resource, cmd, 'myid',
@ -199,7 +198,7 @@ class CLITestV20LbVipJSON(test_cli20.CLITestV20Base):
self._test_update_resource(resource, cmd, 'myid', args, body)
def test_delete_vip(self):
"""lb-vip-delete my-id."""
# lb-vip-delete my-id.
resource = 'vip'
cmd = vip.DeleteVip(test_cli20.MyApp(sys.stdout), None)
my_id = 'my-id'

View File

@ -23,7 +23,7 @@ from neutronclient.tests.unit import test_cli20
class CLITestV20LbHealthMonitorJSON(test_cli20.CLITestV20Base):
def test_create_healthmonitor_with_mandatory_params(self):
"""lbaas-healthmonitor-create with mandatory params only."""
# lbaas-healthmonitor-create with mandatory params only.
resource = 'healthmonitor'
cmd_resource = 'lbaas_healthmonitor'
cmd = healthmonitor.CreateHealthMonitor(test_cli20.MyApp(sys.stdout),
@ -43,7 +43,7 @@ class CLITestV20LbHealthMonitorJSON(test_cli20.CLITestV20Base):
cmd_resource=cmd_resource)
def test_create_healthmonitor_with_all_params(self):
"""lbaas-healthmonitor-create with all params set."""
# lbaas-healthmonitor-create with all params set.
resource = 'healthmonitor'
cmd_resource = 'lbaas_healthmonitor'
cmd = healthmonitor.CreateHealthMonitor(test_cli20.MyApp(sys.stdout),
@ -71,7 +71,7 @@ class CLITestV20LbHealthMonitorJSON(test_cli20.CLITestV20Base):
cmd_resource=cmd_resource)
def test_list_healthmonitors(self):
"""lbaas-healthmonitor-list."""
# lbaas-healthmonitor-list.
resources = 'healthmonitors'
cmd_resources = 'lbaas_healthmonitors'
cmd = healthmonitor.ListHealthMonitor(test_cli20.MyApp(sys.stdout),
@ -80,7 +80,7 @@ class CLITestV20LbHealthMonitorJSON(test_cli20.CLITestV20Base):
cmd_resources=cmd_resources)
def test_list_healthmonitors_pagination(self):
"""lbaas-healthmonitor-list with pagination."""
# lbaas-healthmonitor-list with pagination.
resources = 'healthmonitors'
cmd_resources = 'lbaas_healthmonitors'
cmd = healthmonitor.ListHealthMonitor(test_cli20.MyApp(sys.stdout),
@ -89,7 +89,7 @@ class CLITestV20LbHealthMonitorJSON(test_cli20.CLITestV20Base):
cmd_resources=cmd_resources)
def test_list_healthmonitors_sort(self):
"""lbaas-healthmonitor-list --sort-key id --sort-key asc."""
# lbaas-healthmonitor-list --sort-key id --sort-key asc.
resources = 'healthmonitors'
cmd_resources = 'lbaas_healthmonitors'
cmd = healthmonitor.ListHealthMonitor(test_cli20.MyApp(sys.stdout),
@ -98,7 +98,7 @@ class CLITestV20LbHealthMonitorJSON(test_cli20.CLITestV20Base):
cmd_resources=cmd_resources)
def test_list_healthmonitors_limit(self):
"""lbaas-healthmonitor-list -P."""
# lbaas-healthmonitor-list -P.
resources = 'healthmonitors'
cmd_resources = 'lbaas_healthmonitors'
cmd = healthmonitor.ListHealthMonitor(test_cli20.MyApp(sys.stdout),
@ -107,7 +107,7 @@ class CLITestV20LbHealthMonitorJSON(test_cli20.CLITestV20Base):
cmd_resources=cmd_resources)
def test_show_healthmonitor_id(self):
"""lbaas-healthmonitor-show test_id."""
# lbaas-healthmonitor-show test_id.
resource = 'healthmonitor'
cmd_resource = 'lbaas_healthmonitor'
cmd = healthmonitor.ShowHealthMonitor(test_cli20.MyApp(sys.stdout),
@ -117,7 +117,7 @@ class CLITestV20LbHealthMonitorJSON(test_cli20.CLITestV20Base):
cmd_resource=cmd_resource)
def test_show_healthmonitor_id_name(self):
"""lbaas-healthmonitor-show."""
# lbaas-healthmonitor-show.
resource = 'healthmonitor'
cmd_resource = 'lbaas_healthmonitor'
cmd = healthmonitor.ShowHealthMonitor(test_cli20.MyApp(sys.stdout),
@ -128,7 +128,7 @@ class CLITestV20LbHealthMonitorJSON(test_cli20.CLITestV20Base):
cmd_resource=cmd_resource)
def test_update_healthmonitor(self):
"""lbaas-healthmonitor-update myid --name newname."""
# lbaas-healthmonitor-update myid --name newname.
resource = 'healthmonitor'
cmd_resource = 'lbaas_healthmonitor'
cmd = healthmonitor.UpdateHealthMonitor(test_cli20.MyApp(sys.stdout),
@ -139,7 +139,7 @@ class CLITestV20LbHealthMonitorJSON(test_cli20.CLITestV20Base):
cmd_resource=cmd_resource)
def test_delete_healthmonitor(self):
"""lbaas-healthmonitor-delete my-id."""
# lbaas-healthmonitor-delete my-id.
resource = 'healthmonitor'
cmd_resource = 'lbaas_healthmonitor'
cmd = healthmonitor.DeleteHealthMonitor(test_cli20.MyApp(sys.stdout),

View File

@ -23,7 +23,7 @@ from neutronclient.tests.unit import test_cli20
class CLITestV20LbListenerJSON(test_cli20.CLITestV20Base):
def test_create_listener_with_mandatory_params(self):
"""lbaas-listener-create with mandatory params only."""
# lbaas-listener-create with mandatory params only.
resource = 'listener'
cmd_resource = 'lbaas_listener'
cmd = listener.CreateListener(test_cli20.MyApp(sys.stdout), None)
@ -41,7 +41,7 @@ class CLITestV20LbListenerJSON(test_cli20.CLITestV20Base):
cmd_resource=cmd_resource)
def test_create_listener_with_all_params(self):
"""lbaas-listener-create with all params set."""
# lbaas-listener-create with all params set.
resource = 'listener'
cmd_resource = 'lbaas_listener'
cmd = listener.CreateListener(test_cli20.MyApp(sys.stdout), None)
@ -65,7 +65,7 @@ class CLITestV20LbListenerJSON(test_cli20.CLITestV20Base):
cmd_resource=cmd_resource)
def test_list_listeners(self):
"""lbaas-listener-list."""
# lbaas-listener-list.
resources = 'listeners'
cmd_resources = 'lbaas_listeners'
cmd = listener.ListListener(test_cli20.MyApp(sys.stdout), None)
@ -73,7 +73,7 @@ class CLITestV20LbListenerJSON(test_cli20.CLITestV20Base):
cmd_resources=cmd_resources)
def test_list_listeners_pagination(self):
"""lbaas-listener-list with pagination."""
# lbaas-listener-list with pagination.
resources = 'listeners'
cmd_resources = 'lbaas_listeners'
cmd = listener.ListListener(test_cli20.MyApp(sys.stdout), None)
@ -81,7 +81,7 @@ class CLITestV20LbListenerJSON(test_cli20.CLITestV20Base):
cmd_resources=cmd_resources)
def test_list_listeners_sort(self):
"""lbaas-listener-list --sort-key id --sort-key asc."""
# lbaas-listener-list --sort-key id --sort-key asc.
resources = 'listeners'
cmd_resources = 'lbaas_listeners'
cmd = listener.ListListener(test_cli20.MyApp(sys.stdout), None)
@ -89,7 +89,7 @@ class CLITestV20LbListenerJSON(test_cli20.CLITestV20Base):
cmd_resources=cmd_resources)
def test_list_listeners_limit(self):
"""lbaas-listener-list -P."""
# lbaas-listener-list -P.
resources = 'listeners'
cmd_resources = 'lbaas_listeners'
cmd = listener.ListListener(test_cli20.MyApp(sys.stdout), None)
@ -97,7 +97,7 @@ class CLITestV20LbListenerJSON(test_cli20.CLITestV20Base):
cmd_resources=cmd_resources)
def test_show_listener_id(self):
"""lbaas-listener-show test_id."""
# lbaas-listener-show test_id.
resource = 'listener'
cmd_resource = 'lbaas_listener'
cmd = listener.ShowListener(test_cli20.MyApp(sys.stdout), None)
@ -106,7 +106,7 @@ class CLITestV20LbListenerJSON(test_cli20.CLITestV20Base):
cmd_resource=cmd_resource)
def test_show_listener_id_name(self):
"""lbaas-listener-show."""
# lbaas-listener-show.
resource = 'listener'
cmd_resource = 'lbaas_listener'
cmd = listener.ShowListener(test_cli20.MyApp(sys.stdout), None)
@ -116,7 +116,7 @@ class CLITestV20LbListenerJSON(test_cli20.CLITestV20Base):
cmd_resource=cmd_resource)
def test_update_listener(self):
"""lbaas-listener-update myid --name newname."""
# lbaas-listener-update myid --name newname.
resource = 'listener'
cmd_resource = 'lbaas_listener'
cmd = listener.UpdateListener(test_cli20.MyApp(sys.stdout), None)
@ -126,7 +126,7 @@ class CLITestV20LbListenerJSON(test_cli20.CLITestV20Base):
cmd_resource=cmd_resource)
def test_delete_listener(self):
"""lbaas-listener-delete my-id."""
# lbaas-listener-delete my-id.
resource = 'listener'
cmd_resource = 'lbaas_listener'
cmd = listener.DeleteListener(test_cli20.MyApp(sys.stdout), None)

View File

@ -23,7 +23,7 @@ from neutronclient.tests.unit import test_cli20
class CLITestV20LbLoadBalancerJSON(test_cli20.CLITestV20Base):
def test_create_loadbalancer_with_mandatory_params(self):
"""lbaas-loadbalancer-create with mandatory params only."""
# lbaas-loadbalancer-create with mandatory params only.
resource = 'loadbalancer'
cmd_resource = 'lbaas_loadbalancer'
cmd = lb.CreateLoadBalancer(test_cli20.MyApp(sys.stdout), None)
@ -38,7 +38,7 @@ class CLITestV20LbLoadBalancerJSON(test_cli20.CLITestV20Base):
cmd_resource=cmd_resource)
def test_create_loadbalancer_with_all_params(self):
"""lbaas-loadbalancer-create with all params set."""
# lbaas-loadbalancer-create with all params set.
resource = 'loadbalancer'
cmd_resource = 'lbaas_loadbalancer'
cmd = lb.CreateLoadBalancer(test_cli20.MyApp(sys.stdout), None)
@ -57,7 +57,7 @@ class CLITestV20LbLoadBalancerJSON(test_cli20.CLITestV20Base):
cmd_resource=cmd_resource)
def test_list_loadbalancers(self):
"""lbaas-loadbalancer-list."""
# lbaas-loadbalancer-list.
resources = 'loadbalancers'
cmd_resources = 'lbaas_loadbalancers'
cmd = lb.ListLoadBalancer(test_cli20.MyApp(sys.stdout), None)
@ -65,7 +65,7 @@ class CLITestV20LbLoadBalancerJSON(test_cli20.CLITestV20Base):
cmd_resources=cmd_resources)
def test_list_loadbalancers_pagination(self):
"""lbaas-loadbalancer-list with pagination."""
# lbaas-loadbalancer-list with pagination.
resources = 'loadbalancers'
cmd_resources = 'lbaas_loadbalancers'
cmd = lb.ListLoadBalancer(test_cli20.MyApp(sys.stdout), None)
@ -73,9 +73,8 @@ class CLITestV20LbLoadBalancerJSON(test_cli20.CLITestV20Base):
cmd_resources=cmd_resources)
def test_list_loadbalancers_sort(self):
"""lbaas-loadbalancer-list --sort-key name --sort-key id
--sort-key asc --sort-key desc
"""
# lbaas-loadbalancer-list --sort-key name --sort-key id --sort-key asc
# --sort-key desc
resources = 'loadbalancers'
cmd_resources = 'lbaas_loadbalancers'
cmd = lb.ListLoadBalancer(test_cli20.MyApp(sys.stdout), None)
@ -85,7 +84,7 @@ class CLITestV20LbLoadBalancerJSON(test_cli20.CLITestV20Base):
cmd_resources=cmd_resources)
def test_list_loadbalancers_limit(self):
"""lbaas-loadbalancer-list -P."""
# lbaas-loadbalancer-list -P.
resources = 'loadbalancers'
cmd_resources = 'lbaas_loadbalancers'
cmd = lb.ListLoadBalancer(test_cli20.MyApp(sys.stdout), None)
@ -93,7 +92,7 @@ class CLITestV20LbLoadBalancerJSON(test_cli20.CLITestV20Base):
cmd_resources=cmd_resources)
def test_show_loadbalancer_id(self):
"""lbaas-loadbalancer-loadbalancer-show test_id."""
# lbaas-loadbalancer-loadbalancer-show test_id.
resource = 'loadbalancer'
cmd_resource = 'lbaas_loadbalancer'
cmd = lb.ShowLoadBalancer(test_cli20.MyApp(sys.stdout), None)
@ -102,7 +101,7 @@ class CLITestV20LbLoadBalancerJSON(test_cli20.CLITestV20Base):
cmd_resource=cmd_resource)
def test_show_loadbalancer_id_name(self):
"""lbaas-loadbalancer-loadbalancer-show."""
# lbaas-loadbalancer-loadbalancer-show.
resource = 'loadbalancer'
cmd_resource = 'lbaas_loadbalancer'
cmd = lb.ShowLoadBalancer(test_cli20.MyApp(sys.stdout), None)
@ -112,7 +111,7 @@ class CLITestV20LbLoadBalancerJSON(test_cli20.CLITestV20Base):
cmd_resource=cmd_resource)
def test_update_loadbalancer(self):
"""lbaas-loadbalancer-loadbalancer-update myid --name newname."""
# lbaas-loadbalancer-loadbalancer-update myid --name newname.
resource = 'loadbalancer'
cmd_resource = 'lbaas_loadbalancer'
cmd = lb.UpdateLoadBalancer(test_cli20.MyApp(sys.stdout), None)
@ -122,7 +121,7 @@ class CLITestV20LbLoadBalancerJSON(test_cli20.CLITestV20Base):
cmd_resource=cmd_resource)
def test_delete_loadbalancer(self):
"""lbaas-loadbalancer-loadbalancer-delete my-id."""
# lbaas-loadbalancer-loadbalancer-delete my-id.
resource = 'loadbalancer'
cmd_resource = 'lbaas_loadbalancer'
cmd = lb.DeleteLoadBalancer(test_cli20.MyApp(sys.stdout), None)

View File

@ -23,7 +23,7 @@ from neutronclient.tests.unit import test_cli20
class CLITestV20LbMemberJSON(test_cli20.CLITestV20Base):
def test_create_member_with_mandatory_params(self):
"""lbaas-member-create with mandatory params only."""
# lbaas-member-create with mandatory params only.
resource = 'member'
cmd_resource = 'lbaas_member'
cmd = member.CreateMember(test_cli20.MyApp(sys.stdout), None)
@ -43,7 +43,7 @@ class CLITestV20LbMemberJSON(test_cli20.CLITestV20Base):
parent_id=pool_id)
def test_create_member_with_all_params(self):
"""lbaas-member-create with all params set."""
# lbaas-member-create with all params set.
resource = 'member'
cmd_resource = 'lbaas_member'
cmd = member.CreateMember(test_cli20.MyApp(sys.stdout), None)
@ -65,7 +65,7 @@ class CLITestV20LbMemberJSON(test_cli20.CLITestV20Base):
parent_id=pool_id)
def test_list_members(self):
"""lbaas-member-list."""
# lbaas-member-list.
resources = 'members'
cmd_resources = 'lbaas_members'
pool_id = 'pool-id'
@ -76,7 +76,7 @@ class CLITestV20LbMemberJSON(test_cli20.CLITestV20Base):
query="pool_id=%s" % pool_id)
def test_list_members_pagination(self):
"""lbaas-member-list with pagination."""
# lbaas-member-list with pagination.
resources = 'members'
cmd_resources = 'lbaas_members'
pool_id = 'pool-id'
@ -88,7 +88,7 @@ class CLITestV20LbMemberJSON(test_cli20.CLITestV20Base):
query="pool_id=%s" % pool_id)
def test_list_members_sort(self):
"""lbaas-member-list --sort-key id --sort-key asc."""
# lbaas-member-list --sort-key id --sort-key asc.
resources = 'members'
cmd_resources = 'lbaas_members'
pool_id = 'pool-id'
@ -99,7 +99,7 @@ class CLITestV20LbMemberJSON(test_cli20.CLITestV20Base):
query="pool_id=%s" % pool_id)
def test_list_members_limit(self):
"""lbaas-member-list -P."""
# lbaas-member-list -P.
resources = 'members'
cmd_resources = 'lbaas_members'
pool_id = 'pool-id'
@ -111,7 +111,7 @@ class CLITestV20LbMemberJSON(test_cli20.CLITestV20Base):
query="pool_id=%s" % pool_id)
def test_show_member_id(self):
"""lbaas-member-show test_id."""
# lbaas-member-show test_id.
resource = 'member'
cmd_resource = 'lbaas_member'
pool_id = 'pool-id'
@ -121,7 +121,7 @@ class CLITestV20LbMemberJSON(test_cli20.CLITestV20Base):
cmd_resource=cmd_resource, parent_id=pool_id)
def test_show_member_id_name(self):
"""lbaas-member-show."""
# lbaas-member-show.
resource = 'member'
cmd_resource = 'lbaas_member'
pool_id = 'pool-id'
@ -132,7 +132,7 @@ class CLITestV20LbMemberJSON(test_cli20.CLITestV20Base):
cmd_resource=cmd_resource, parent_id=pool_id)
def test_update_member(self):
"""lbaas-member-update myid --name newname."""
# lbaas-member-update myid --name newname.
resource = 'member'
cmd_resource = 'lbaas_member'
my_id = 'my-id'
@ -145,7 +145,7 @@ class CLITestV20LbMemberJSON(test_cli20.CLITestV20Base):
parent_id=pool_id)
def test_delete_member(self):
"""lbaas-member-delete my-id."""
# lbaas-member-delete my-id.
resource = 'member'
cmd_resource = 'lbaas_member'
cmd = member.DeleteMember(test_cli20.MyApp(sys.stdout), None)

View File

@ -23,7 +23,7 @@ from neutronclient.tests.unit import test_cli20
class CLITestV20LbPoolJSON(test_cli20.CLITestV20Base):
def test_create_pool_with_mandatory_params(self):
"""lbaas-pool-create with mandatory params only."""
# lbaas-pool-create with mandatory params only.
resource = 'pool'
cmd_resource = 'lbaas_pool'
cmd = pool.CreatePool(test_cli20.MyApp(sys.stdout), None)
@ -41,7 +41,7 @@ class CLITestV20LbPoolJSON(test_cli20.CLITestV20Base):
cmd_resource=cmd_resource)
def test_create_pool_with_all_params(self):
"""lbaas-pool-create with all params set."""
# lbaas-pool-create with all params set.
resource = 'pool'
cmd_resource = 'lbaas_pool'
cmd = pool.CreatePool(test_cli20.MyApp(sys.stdout), None)
@ -68,7 +68,7 @@ class CLITestV20LbPoolJSON(test_cli20.CLITestV20Base):
cmd_resource=cmd_resource)
def test_list_pools(self):
"""lbaas-pool-list."""
# lbaas-pool-list.
resources = 'pools'
cmd_resources = 'lbaas_pools'
cmd = pool.ListPool(test_cli20.MyApp(sys.stdout), None)
@ -76,7 +76,7 @@ class CLITestV20LbPoolJSON(test_cli20.CLITestV20Base):
cmd_resources=cmd_resources)
def test_list_pools_pagination(self):
"""lbaas-pool-list with pagination."""
# lbaas-pool-list with pagination.
resources = 'pools'
cmd_resources = 'lbaas_pools'
cmd = pool.ListPool(test_cli20.MyApp(sys.stdout), None)
@ -84,7 +84,7 @@ class CLITestV20LbPoolJSON(test_cli20.CLITestV20Base):
cmd_resources=cmd_resources)
def test_list_pools_sort(self):
"""lbaas-pool-list --sort-key id --sort-key asc."""
# lbaas-pool-list --sort-key id --sort-key asc.
resources = 'pools'
cmd_resources = 'lbaas_pools'
cmd = pool.ListPool(test_cli20.MyApp(sys.stdout), None)
@ -92,7 +92,7 @@ class CLITestV20LbPoolJSON(test_cli20.CLITestV20Base):
cmd_resources=cmd_resources)
def test_list_pools_limit(self):
"""lbaas-pool-list -P."""
# lbaas-pool-list -P.
resources = 'pools'
cmd_resources = 'lbaas_pools'
cmd = pool.ListPool(test_cli20.MyApp(sys.stdout), None)
@ -100,7 +100,7 @@ class CLITestV20LbPoolJSON(test_cli20.CLITestV20Base):
cmd_resources=cmd_resources)
def test_show_pool_id(self):
"""lbaas-pool-show test_id."""
# lbaas-pool-show test_id.
resource = 'pool'
cmd_resource = 'lbaas_pool'
cmd = pool.ShowPool(test_cli20.MyApp(sys.stdout), None)
@ -109,7 +109,7 @@ class CLITestV20LbPoolJSON(test_cli20.CLITestV20Base):
cmd_resource=cmd_resource)
def test_show_pool_id_name(self):
"""lbaas-pool-show."""
# lbaas-pool-show.
resource = 'pool'
cmd_resource = 'lbaas_pool'
cmd = pool.ShowPool(test_cli20.MyApp(sys.stdout), None)
@ -119,7 +119,7 @@ class CLITestV20LbPoolJSON(test_cli20.CLITestV20Base):
cmd_resource=cmd_resource)
def test_update_pool(self):
"""lbaas-pool-update myid --name newname."""
# lbaas-pool-update myid --name newname.
resource = 'pool'
cmd_resource = 'lbaas_pool'
cmd = pool.UpdatePool(test_cli20.MyApp(sys.stdout), None)
@ -129,7 +129,7 @@ class CLITestV20LbPoolJSON(test_cli20.CLITestV20Base):
cmd_resource=cmd_resource)
def test_delete_pool(self):
"""lbaas-pool-delete my-id."""
# lbaas-pool-delete my-id.
resource = 'pool'
cmd_resource = 'lbaas_pool'
cmd = pool.DeletePool(test_cli20.MyApp(sys.stdout), None)

View File

@ -32,7 +32,7 @@ class CLITestV20QoSPolicyJSON(test_cli20.CLITestV20Base):
self.cmd_ress = 'qos_policies'
def test_create_policy_with_only_keyattributes(self):
"""Create qos policy abc."""
# Create qos policy abc.
cmd = policy.CreateQoSPolicy(test_cli20.MyApp(sys.stdout),
None)
myid = 'myid'
@ -45,7 +45,7 @@ class CLITestV20QoSPolicyJSON(test_cli20.CLITestV20Base):
cmd_resource=self.cmd_res)
def test_create_policy_with_description(self):
"""Create qos policy xyz --description abc."""
# Create qos policy xyz --description abc.
cmd = policy.CreateQoSPolicy(test_cli20.MyApp(sys.stdout),
None)
myid = 'myid'
@ -59,7 +59,7 @@ class CLITestV20QoSPolicyJSON(test_cli20.CLITestV20Base):
cmd_resource=self.cmd_res)
def test_create_policy_with_shared(self):
"""Create qos policy abc shared across tenants"""
# Create qos policy abc shared across tenants
cmd = policy.CreateQoSPolicy(test_cli20.MyApp(sys.stdout),
None)
myid = 'myid'
@ -73,7 +73,7 @@ class CLITestV20QoSPolicyJSON(test_cli20.CLITestV20Base):
cmd_resource=self.cmd_res)
def test_create_policy_with_unicode(self):
"""Create qos policy u'\u7f51\u7edc'."""
# Create qos policy u'\u7f51\u7edc'.
cmd = policy.CreateQoSPolicy(test_cli20.MyApp(sys.stdout),
None)
myid = 'myid'
@ -87,7 +87,7 @@ class CLITestV20QoSPolicyJSON(test_cli20.CLITestV20Base):
cmd_resource=self.cmd_res)
def test_update_policy(self):
"""policy-update myid --name newname."""
# policy-update myid --name newname.
cmd = policy.UpdateQoSPolicy(test_cli20.MyApp(sys.stdout),
None)
self._test_update_resource(self.res, cmd, 'myid',
@ -96,7 +96,7 @@ class CLITestV20QoSPolicyJSON(test_cli20.CLITestV20Base):
cmd_resource=self.cmd_res)
def test_update_policy_description(self):
"""policy-update myid --name newname --description newdesc"""
# policy-update myid --name newname --description newdesc
cmd = policy.UpdateQoSPolicy(test_cli20.MyApp(sys.stdout),
None)
self._test_update_resource(self.res, cmd, 'myid',
@ -105,23 +105,22 @@ class CLITestV20QoSPolicyJSON(test_cli20.CLITestV20Base):
cmd_resource=self.cmd_res)
def test_list_policies(self):
"""qos-policy-list."""
# qos-policy-list.
cmd = policy.ListQoSPolicy(test_cli20.MyApp(sys.stdout),
None)
self._test_list_resources(self.ress, cmd, True,
cmd_resources=self.cmd_ress)
def test_list_policies_pagination(self):
"""qos-policy-list for pagination."""
# qos-policy-list for pagination.
cmd = policy.ListQoSPolicy(test_cli20.MyApp(sys.stdout),
None)
self._test_list_resources_with_pagination(self.ress, cmd,
cmd_resources=self.cmd_ress)
def test_list_policies_sort(self):
"""sorted list: qos-policy-list --sort-key name --sort-key id
--sort-key asc --sort-key desc
"""
# sorted list: qos-policy-list --sort-key name --sort-key id
# --sort-key asc --sort-key desc
cmd = policy.ListQoSPolicy(test_cli20.MyApp(sys.stdout),
None)
self._test_list_resources(self.ress, cmd,
@ -130,14 +129,14 @@ class CLITestV20QoSPolicyJSON(test_cli20.CLITestV20Base):
cmd_resources=self.cmd_ress)
def test_list_policies_limit(self):
"""size (1000) limited list: qos-policy-list -P."""
# size (1000) limited list: qos-policy-list -P.
cmd = policy.ListQoSPolicy(test_cli20.MyApp(sys.stdout),
None)
self._test_list_resources(self.ress, cmd, page_size=1000,
cmd_resources=self.cmd_ress)
def test_show_policy_id(self):
"""qos-policy-show test_id."""
# qos-policy-show test_id.
cmd = policy.ShowQoSPolicy(test_cli20.MyApp(sys.stdout),
None)
args = ['--fields', 'id', self.test_id]
@ -145,7 +144,7 @@ class CLITestV20QoSPolicyJSON(test_cli20.CLITestV20Base):
['id'], cmd_resource=self.cmd_res)
def test_show_policy_name(self):
"""qos-policy-show."""
# qos-policy-show.
cmd = policy.ShowQoSPolicy(test_cli20.MyApp(sys.stdout),
None)
args = ['--fields', 'id', '--fields', 'name', self.test_id]
@ -154,7 +153,7 @@ class CLITestV20QoSPolicyJSON(test_cli20.CLITestV20Base):
cmd_resource=self.cmd_res)
def test_delete_policy(self):
"""qos-policy-delete my-id."""
# qos-policy-delete my-id.
cmd = policy.DeleteQoSPolicy(test_cli20.MyApp(sys.stdout),
None)
my_id = 'myid1'

View File

@ -138,7 +138,7 @@ class CLITestV20QoSRuleJSON(test_cli20.CLITestV20Base):
parent_id=policy_id)
def test_list_qos_rule_types(self):
"""qos_rule_types."""
# qos_rule_types.
resources = 'rule_types'
cmd_resources = 'qos_rule_types'
response_contents = [{'type': 'bandwidth_limit'}]

View File

@ -31,7 +31,7 @@ class CLITestV20AddressScopeJSON(test_cli20.CLITestV20Base):
super(CLITestV20AddressScopeJSON, self).setUp(plurals={'tags': 'tag'})
def test_create_address_scope_with_minimum_option(self):
"""Create address_scope: foo-address-scope with minimum option."""
# Create address_scope: foo-address-scope with minimum option.
resource = 'address_scope'
cmd = address_scope.CreateAddressScope(
test_cli20.MyApp(sys.stdout), None)
@ -44,7 +44,7 @@ class CLITestV20AddressScopeJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_create_address_scope_with_all_option(self):
"""Create address_scope: foo-address-scope with all options."""
# Create address_scope: foo-address-scope with all options.
resource = 'address_scope'
cmd = address_scope.CreateAddressScope(
test_cli20.MyApp(sys.stdout), None)
@ -57,7 +57,7 @@ class CLITestV20AddressScopeJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_create_address_scope_with_unicode(self):
"""Create address_scope: u'\u7f51\u7edc'."""
# Create address_scope: u'\u7f51\u7edc'.
resource = 'address_scope'
cmd = address_scope.CreateAddressScope(
test_cli20.MyApp(sys.stdout), None)
@ -70,7 +70,7 @@ class CLITestV20AddressScopeJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_update_address_scope_exception(self):
"""Update address_scope (Negative) : myid."""
# Update address_scope (Negative) : myid.
resource = 'address_scope'
cmd = address_scope.UpdateAddressScope(
test_cli20.MyApp(sys.stdout), None)
@ -78,7 +78,7 @@ class CLITestV20AddressScopeJSON(test_cli20.CLITestV20Base):
resource, cmd, 'myid', ['myid'], {})
def test_update_address_scope(self):
"""Update address_scope: myid --name newname-address-scope."""
# Update address_scope: myid --name newname-address-scope.
resource = 'address_scope'
cmd = address_scope.UpdateAddressScope(
test_cli20.MyApp(sys.stdout), None)
@ -88,14 +88,14 @@ class CLITestV20AddressScopeJSON(test_cli20.CLITestV20Base):
)
def test_list_address_scope(self):
"""address_scope-list."""
# address_scope-list.
resources = "address_scopes"
cmd = address_scope.ListAddressScope(test_cli20.MyApp(sys.stdout),
None)
self._test_list_resources(resources, cmd, True)
def test_list_address_scope_pagination(self):
"""address_scope-list."""
# address_scope-list.
cmd = address_scope.ListAddressScope(test_cli20.MyApp(sys.stdout),
None)
self.mox.StubOutWithMock(address_scope.ListAddressScope,
@ -108,9 +108,9 @@ class CLITestV20AddressScopeJSON(test_cli20.CLITestV20Base):
self.mox.UnsetStubs()
def test_list_address_scope_sort(self):
"""sorted list: address_scope-list --sort-key name --sort-key id
--sort-key asc --sort-key desc
"""
# sorted list:
# address_scope-list --sort-key name --sort-key id --sort-key asc
# --sort-key desc
resources = "address_scopes"
cmd = address_scope.ListAddressScope(test_cli20.MyApp(sys.stdout),
None)
@ -119,14 +119,14 @@ class CLITestV20AddressScopeJSON(test_cli20.CLITestV20Base):
sort_dir=["asc", "desc"])
def test_list_address_scope_limit(self):
"""size (1000) limited list: address_scope-list -P."""
# size (1000) limited list: address_scope-list -P.
resources = "address_scopes"
cmd = address_scope.ListAddressScope(test_cli20.MyApp(sys.stdout),
None)
self._test_list_resources(resources, cmd, page_size=1000)
def test_show_address_scope(self):
"""Show address_scope: --fields id --fields name myid."""
# Show address_scope: --fields id --fields name myid.
resource = 'address_scope'
cmd = address_scope.ShowAddressScope(
test_cli20.MyApp(sys.stdout), None)
@ -135,7 +135,7 @@ class CLITestV20AddressScopeJSON(test_cli20.CLITestV20Base):
['id', 'name'])
def test_delete_address_scope(self):
"""Delete address_scope: address_scope_id."""
# Delete address_scope: address_scope_id.
resource = 'address_scope'
cmd = address_scope.DeleteAddressScope(
test_cli20.MyApp(sys.stdout), None)

View File

@ -55,7 +55,7 @@ class CLITestV20Agent(test_cli20.CLITestV20Base):
self.assertIn(smile, ag.values())
def test_update_agent(self):
"""agent-update myid --admin-state-down --description mydescr."""
# agent-update myid --admin-state-down --description mydescr.
resource = 'agent'
cmd = agent.UpdateAgent(test_cli20.MyApp(sys.stdout), None)
self._test_update_resource(
@ -65,7 +65,7 @@ class CLITestV20Agent(test_cli20.CLITestV20Base):
)
def test_show_agent(self):
"""Show agent: --field id --field binary myid."""
# Show agent: --field id --field binary myid.
resource = 'agent'
cmd = agent.ShowAgent(test_cli20.MyApp(sys.stdout), None)
args = ['--field', 'id', '--field', 'binary', self.test_id]
@ -73,7 +73,7 @@ class CLITestV20Agent(test_cli20.CLITestV20Base):
args, ['id', 'binary'])
def test_delete_agent(self):
"""Delete agent: myid."""
# Delete agent: myid.
resource = 'agent'
cmd = agent.DeleteAgent(test_cli20.MyApp(sys.stdout), None)
myid = 'myid'

View File

@ -25,7 +25,7 @@ class CLITestV20FloatingIpsJSON(test_cli20.CLITestV20Base):
non_admin_status_resources = ['floatingip']
def test_create_floatingip(self):
"""Create floatingip: fip1."""
# Create floatingip: fip1.
resource = 'floatingip'
cmd = fip.CreateFloatingIP(test_cli20.MyApp(sys.stdout), None)
name = 'fip1'
@ -37,7 +37,7 @@ class CLITestV20FloatingIpsJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_create_floatingip_and_port(self):
"""Create floatingip: fip1."""
# Create floatingip: fip1.
resource = 'floatingip'
cmd = fip.CreateFloatingIP(test_cli20.MyApp(sys.stdout), None)
name = 'fip1'
@ -56,7 +56,7 @@ class CLITestV20FloatingIpsJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_create_floatingip_and_port_and_address(self):
"""Create floatingip: fip1 with a given port and address."""
# Create floatingip: fip1 with a given port and address.
resource = 'floatingip'
cmd = fip.CreateFloatingIP(test_cli20.MyApp(sys.stdout), None)
name = 'fip1'
@ -75,7 +75,7 @@ class CLITestV20FloatingIpsJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_create_floatingip_with_ip_address_of_floating_ip(self):
"""Create floatingip: fip1 with a given IP address of floating IP."""
# Create floatingip: fip1 with a given IP address of floating IP.
resource = 'floatingip'
cmd = fip.CreateFloatingIP(test_cli20.MyApp(sys.stdout), None)
name = 'fip1'
@ -89,7 +89,7 @@ class CLITestV20FloatingIpsJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_create_floatingip_with_subnet_id(self):
"""Create floatingip: fip1 on a given subnet id."""
# Create floatingip: fip1 on a given subnet id.
resource = 'floatingip'
cmd = fip.CreateFloatingIP(test_cli20.MyApp(sys.stdout), None)
name = 'fip1'
@ -103,7 +103,7 @@ class CLITestV20FloatingIpsJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_create_floatingip_with_subnet_id_and_port(self):
"""Create floatingip: fip1 on a given subnet id and port."""
# Create floatingip: fip1 on a given subnet id and port.
resource = 'floatingip'
cmd = fip.CreateFloatingIP(test_cli20.MyApp(sys.stdout), None)
name = 'fip1'
@ -118,7 +118,7 @@ class CLITestV20FloatingIpsJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_list_floatingips(self):
"""list floatingips: -D."""
# list floatingips: -D.
resources = 'floatingips'
cmd = fip.ListFloatingIP(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd, True)
@ -129,9 +129,8 @@ class CLITestV20FloatingIpsJSON(test_cli20.CLITestV20Base):
self._test_list_resources_with_pagination(resources, cmd)
def test_list_floatingips_sort(self):
"""list floatingips: --sort-key name --sort-key id --sort-key asc
--sort-key desc
"""
# list floatingips:
# --sort-key name --sort-key id --sort-key asc --sort-key desc
resources = 'floatingips'
cmd = fip.ListFloatingIP(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd,
@ -139,13 +138,13 @@ class CLITestV20FloatingIpsJSON(test_cli20.CLITestV20Base):
sort_dir=["asc", "desc"])
def test_list_floatingips_limit(self):
"""list floatingips: -P."""
# list floatingips: -P.
resources = 'floatingips'
cmd = fip.ListFloatingIP(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd, page_size=1000)
def test_delete_floatingip(self):
"""Delete floatingip: fip1."""
# Delete floatingip: fip1.
resource = 'floatingip'
cmd = fip.DeleteFloatingIP(test_cli20.MyApp(sys.stdout), None)
myid = 'myid'
@ -153,7 +152,7 @@ class CLITestV20FloatingIpsJSON(test_cli20.CLITestV20Base):
self._test_delete_resource(resource, cmd, myid, args)
def test_show_floatingip(self):
"""Show floatingip: --fields id."""
# Show floatingip: --fields id.
resource = 'floatingip'
cmd = fip.ShowFloatingIP(test_cli20.MyApp(sys.stdout), None)
args = ['--fields', 'id', self.test_id]
@ -161,7 +160,7 @@ class CLITestV20FloatingIpsJSON(test_cli20.CLITestV20Base):
args, ['id'])
def test_disassociate_ip(self):
"""Disassociate floating IP: myid."""
# Disassociate floating IP: myid.
resource = 'floatingip'
cmd = fip.DisassociateFloatingIP(test_cli20.MyApp(sys.stdout), None)
args = ['myid']
@ -170,7 +169,7 @@ class CLITestV20FloatingIpsJSON(test_cli20.CLITestV20Base):
)
def test_associate_ip(self):
"""Associate floating IP: myid portid."""
# Associate floating IP: myid portid.
resource = 'floatingip'
cmd = fip.AssociateFloatingIP(test_cli20.MyApp(sys.stdout), None)
args = ['myid', 'portid']

View File

@ -23,7 +23,7 @@ class CLITestV20MeteringJSON(test_cli20.CLITestV20Base):
non_admin_status_resources = ['metering_label', 'metering_label_rule']
def test_create_metering_label(self):
"""Create a metering label."""
# Create a metering label.
resource = 'metering_label'
cmd = metering.CreateMeteringLabel(
test_cli20.MyApp(sys.stdout), None)
@ -43,7 +43,7 @@ class CLITestV20MeteringJSON(test_cli20.CLITestV20Base):
self._test_list_resources(resources, cmd)
def test_delete_metering_label(self):
"""Delete a metering label."""
# Delete a metering label.
resource = 'metering_label'
cmd = metering.DeleteMeteringLabel(
test_cli20.MyApp(sys.stdout), None)

View File

@ -30,7 +30,7 @@ class CLITestV20NetworkJSON(test_cli20.CLITestV20Base):
super(CLITestV20NetworkJSON, self).setUp(plurals={'tags': 'tag'})
def test_create_network(self):
"""Create net: myname."""
# Create net: myname.
resource = 'network'
cmd = network.CreateNetwork(test_cli20.MyApp(sys.stdout), None)
name = 'myname'
@ -42,7 +42,7 @@ class CLITestV20NetworkJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_create_network_with_unicode(self):
"""Create net: u'\u7f51\u7edc'."""
# Create net: u'\u7f51\u7edc'.
resource = 'network'
cmd = network.CreateNetwork(test_cli20.MyApp(sys.stdout), None)
name = u'\u7f51\u7edc'
@ -54,7 +54,7 @@ class CLITestV20NetworkJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_create_network_tenant(self):
"""Create net: --tenant_id tenantid myname."""
# Create net: --tenant_id tenantid myname.
resource = 'network'
cmd = network.CreateNetwork(test_cli20.MyApp(sys.stdout), None)
name = 'myname'
@ -73,7 +73,7 @@ class CLITestV20NetworkJSON(test_cli20.CLITestV20Base):
tenant_id='tenantid')
def test_create_network_provider_args(self):
"""Create net: with --provider arguments."""
# Create net: with --provider arguments.
resource = 'network'
cmd = network.CreateNetwork(test_cli20.MyApp(sys.stdout), None)
name = 'myname'
@ -91,7 +91,7 @@ class CLITestV20NetworkJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_create_network_tags(self):
"""Create net: myname --tags a b."""
# Create net: myname --tags a b.
resource = 'network'
cmd = network.CreateNetwork(test_cli20.MyApp(sys.stdout), None)
name = 'myname'
@ -104,7 +104,7 @@ class CLITestV20NetworkJSON(test_cli20.CLITestV20Base):
tags=['a', 'b'])
def test_create_network_state(self):
"""Create net: --admin_state_down myname."""
# Create net: --admin_state_down myname.
resource = 'network'
cmd = network.CreateNetwork(test_cli20.MyApp(sys.stdout), None)
name = 'myname'
@ -123,7 +123,7 @@ class CLITestV20NetworkJSON(test_cli20.CLITestV20Base):
admin_state_up=False)
def test_create_network_vlan_transparent(self):
"""Create net: myname --vlan-transparent True."""
# Create net: myname --vlan-transparent True.
resource = 'network'
cmd = network.CreateNetwork(test_cli20.MyApp(sys.stdout), None)
name = 'myname'
@ -137,7 +137,7 @@ class CLITestV20NetworkJSON(test_cli20.CLITestV20Base):
**vlantrans)
def test_create_network_with_qos_policy(self):
"""Create net: --qos-policy mypolicy."""
# Create net: --qos-policy mypolicy.
resource = 'network'
cmd = network.CreateNetwork(test_cli20.MyApp(sys.stdout), None)
name = 'myname'
@ -150,9 +150,8 @@ class CLITestV20NetworkJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_create_network_with_az_hint(self):
"""Create net: --availability-zone-hint zone1
--availability-zone-hint zone2.
"""
# Create net: --availability-zone-hint zone1
# --availability-zone-hint zone2.
resource = 'network'
cmd = network.CreateNetwork(test_cli20.MyApp(sys.stdout), None)
name = 'myname'
@ -212,49 +211,46 @@ class CLITestV20NetworkJSON(test_cli20.CLITestV20Base):
self._test_list_resources_with_pagination("networks", cmd)
def test_list_nets_sort(self):
"""list nets: --sort-key name --sort-key id --sort-dir asc
--sort-dir desc
"""
# list nets:
# --sort-key name --sort-key id --sort-dir asc --sort-dir desc
cmd = network.ListNetwork(test_cli20.MyApp(sys.stdout), None)
self._test_list_networks(cmd, sort_key=['name', 'id'],
sort_dir=['asc', 'desc'])
def test_list_nets_sort_with_keys_more_than_dirs(self):
"""list nets: --sort-key name --sort-key id --sort-dir desc
"""
# list nets: --sort-key name --sort-key id --sort-dir desc
cmd = network.ListNetwork(test_cli20.MyApp(sys.stdout), None)
self._test_list_networks(cmd, sort_key=['name', 'id'],
sort_dir=['desc'])
def test_list_nets_sort_with_dirs_more_than_keys(self):
"""list nets: --sort-key name --sort-dir desc --sort-dir asc
"""
# list nets: --sort-key name --sort-dir desc --sort-dir asc
cmd = network.ListNetwork(test_cli20.MyApp(sys.stdout), None)
self._test_list_networks(cmd, sort_key=['name'],
sort_dir=['desc', 'asc'])
def test_list_nets_limit(self):
"""list nets: -P."""
# list nets: -P.
cmd = network.ListNetwork(test_cli20.MyApp(sys.stdout), None)
self._test_list_networks(cmd, page_size=1000)
def test_list_nets_detail(self):
"""list nets: -D."""
# list nets: -D.
cmd = network.ListNetwork(test_cli20.MyApp(sys.stdout), None)
self._test_list_networks(cmd, True)
def test_list_nets_tags(self):
"""List nets: -- --tags a b."""
# List nets: -- --tags a b.
cmd = network.ListNetwork(test_cli20.MyApp(sys.stdout), None)
self._test_list_networks(cmd, tags=['a', 'b'])
def test_list_nets_tags_with_unicode(self):
"""List nets: -- --tags u'\u7f51\u7edc'."""
# List nets: -- --tags u'\u7f51\u7edc'.
cmd = network.ListNetwork(test_cli20.MyApp(sys.stdout), None)
self._test_list_networks(cmd, tags=[u'\u7f51\u7edc'])
def test_list_nets_detail_tags(self):
"""List nets: -D -- --tags a b."""
# List nets: -D -- --tags a b.
cmd = network.ListNetwork(test_cli20.MyApp(sys.stdout), None)
self._test_list_networks(cmd, detail=True, tags=['a', 'b'])
@ -321,7 +317,7 @@ class CLITestV20NetworkJSON(test_cli20.CLITestV20Base):
self._test_list_nets_extend_subnets(data, expected)
def test_list_nets_fields(self):
"""List nets: --fields a --fields b -- --fields c d."""
# List nets: --fields a --fields b -- --fields c d.
cmd = network.ListNetwork(test_cli20.MyApp(sys.stdout), None)
self._test_list_networks(cmd,
fields_1=['a', 'b'], fields_2=['c', 'd'])
@ -459,27 +455,27 @@ class CLITestV20NetworkJSON(test_cli20.CLITestV20Base):
self.assertIn('myid1', _str)
def test_list_external_nets_detail(self):
"""list external nets: -D."""
# list external nets: -D.
resources = "networks"
cmd = network.ListExternalNetwork(test_cli20.MyApp(sys.stdout), None)
self._test_list_external_nets(resources, cmd, True)
def test_list_external_nets_tags(self):
"""List external nets: -- --tags a b."""
# List external nets: -- --tags a b.
resources = "networks"
cmd = network.ListExternalNetwork(test_cli20.MyApp(sys.stdout), None)
self._test_list_external_nets(resources,
cmd, tags=['a', 'b'])
def test_list_external_nets_detail_tags(self):
"""List external nets: -D -- --tags a b."""
# List external nets: -D -- --tags a b.
resources = "networks"
cmd = network.ListExternalNetwork(test_cli20.MyApp(sys.stdout), None)
self._test_list_external_nets(resources, cmd,
detail=True, tags=['a', 'b'])
def test_list_externel_nets_fields(self):
"""List external nets: --fields a --fields b -- --fields c d."""
# List external nets: --fields a --fields b -- --fields c d.
resources = "networks"
cmd = network.ListExternalNetwork(test_cli20.MyApp(sys.stdout), None)
self._test_list_external_nets(resources, cmd,
@ -487,14 +483,14 @@ class CLITestV20NetworkJSON(test_cli20.CLITestV20Base):
fields_2=['c', 'd'])
def test_update_network_exception(self):
"""Update net: myid."""
# Update net: myid.
resource = 'network'
cmd = network.UpdateNetwork(test_cli20.MyApp(sys.stdout), None)
self.assertRaises(exceptions.CommandError, self._test_update_resource,
resource, cmd, 'myid', ['myid'], {})
def test_update_network(self):
"""Update net: myid --name myname --tags a b."""
# Update net: myid --name myname --tags a b.
resource = 'network'
cmd = network.UpdateNetwork(test_cli20.MyApp(sys.stdout), None)
self._test_update_resource(resource, cmd, 'myid',
@ -504,7 +500,7 @@ class CLITestV20NetworkJSON(test_cli20.CLITestV20Base):
)
def test_update_network_with_unicode(self):
"""Update net: myid --name u'\u7f51\u7edc' --tags a b."""
# Update net: myid --name u'\u7f51\u7edc' --tags a b.
resource = 'network'
cmd = network.UpdateNetwork(test_cli20.MyApp(sys.stdout), None)
self._test_update_resource(resource, cmd, 'myid',
@ -515,7 +511,7 @@ class CLITestV20NetworkJSON(test_cli20.CLITestV20Base):
)
def test_update_network_with_qos_policy(self):
"""Update net: myid --qos-policy mypolicy."""
# Update net: myid --qos-policy mypolicy.
resource = 'network'
cmd = network.UpdateNetwork(test_cli20.MyApp(sys.stdout), None)
self._test_update_resource(resource, cmd, 'myid',
@ -523,7 +519,7 @@ class CLITestV20NetworkJSON(test_cli20.CLITestV20Base):
{'qos_policy_id': 'mypolicy', })
def test_update_network_with_no_qos_policy(self):
"""Update net: myid --no-qos-policy."""
# Update net: myid --no-qos-policy.
resource = 'network'
cmd = network.UpdateNetwork(test_cli20.MyApp(sys.stdout), None)
self._test_update_resource(resource, cmd, 'myid',
@ -531,7 +527,7 @@ class CLITestV20NetworkJSON(test_cli20.CLITestV20Base):
{'qos_policy_id': None, })
def test_show_network(self):
"""Show net: --fields id --fields name myid."""
# Show net: --fields id --fields name myid.
resource = 'network'
cmd = network.ShowNetwork(test_cli20.MyApp(sys.stdout), None)
args = ['--fields', 'id', '--fields', 'name', self.test_id]
@ -539,7 +535,7 @@ class CLITestV20NetworkJSON(test_cli20.CLITestV20Base):
['id', 'name'])
def test_delete_network(self):
"""Delete net: myid."""
# Delete net: myid.
resource = 'network'
cmd = network.DeleteNetwork(test_cli20.MyApp(sys.stdout), None)
myid = 'myid'

View File

@ -29,7 +29,7 @@ class CLITestV20QosQueueJSON(test_cli20.CLITestV20Base):
plurals={'qos_queues': 'qos_queue'})
def test_create_qos_queue(self):
"""Create a qos queue."""
# Create a qos queue.
resource = 'qos_queue'
cmd = qos.CreateQoSQueue(
test_cli20.MyApp(sys.stdout), None)
@ -43,7 +43,7 @@ class CLITestV20QosQueueJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_create_qos_queue_all_values(self):
"""Create a qos queue."""
# Create a qos queue.
resource = 'qos_queue'
cmd = qos.CreateQoSQueue(
test_cli20.MyApp(sys.stdout), None)

View File

@ -29,7 +29,7 @@ class CLITestV20PortJSON(test_cli20.CLITestV20Base):
super(CLITestV20PortJSON, self).setUp(plurals={'tags': 'tag'})
def test_create_port(self):
"""Create port: netid."""
# Create port: netid.
resource = 'port'
cmd = port.CreatePort(test_cli20.MyApp(sys.stdout), None)
name = 'myname'
@ -43,7 +43,7 @@ class CLITestV20PortJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_create_port_extra_dhcp_opts_args(self):
"""Create port: netid --extra_dhcp_opt."""
# Create port: netid --extra_dhcp_opt.
resource = 'port'
cmd = port.CreatePort(test_cli20.MyApp(sys.stdout), None)
name = 'myname'
@ -67,7 +67,7 @@ class CLITestV20PortJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_create_port_extra_dhcp_opts_args_ip_version(self):
"""Create port: netid --extra_dhcp_opt."""
# Create port: netid --extra_dhcp_opt.
resource = 'port'
cmd = port.CreatePort(test_cli20.MyApp(sys.stdout), None)
name = 'myname'
@ -95,7 +95,7 @@ class CLITestV20PortJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_create_port_full(self):
"""Create port: --mac_address mac --device_id deviceid netid."""
# Create port: --mac_address mac --device_id deviceid netid.
resource = 'port'
cmd = port.CreatePort(test_cli20.MyApp(sys.stdout), None)
name = 'myname'
@ -114,7 +114,7 @@ class CLITestV20PortJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_create_port_vnic_type_normal(self):
"""Create port: --vnic_type normal netid."""
# Create port: --vnic_type normal netid.
resource = 'port'
cmd = port.CreatePort(test_cli20.MyApp(sys.stdout), None)
name = 'myname'
@ -134,7 +134,7 @@ class CLITestV20PortJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_create_port_vnic_type_direct(self):
"""Create port: --vnic_type direct netid."""
# Create port: --vnic_type direct netid.
resource = 'port'
cmd = port.CreatePort(test_cli20.MyApp(sys.stdout), None)
name = 'myname'
@ -154,7 +154,7 @@ class CLITestV20PortJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_create_port_vnic_type_macvtap(self):
"""Create port: --vnic_type macvtap netid."""
# Create port: --vnic_type macvtap netid.
resource = 'port'
cmd = port.CreatePort(test_cli20.MyApp(sys.stdout), None)
name = 'myname'
@ -174,7 +174,7 @@ class CLITestV20PortJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_create_port_vnic_type_baremetal(self):
"""Create port: --vnic_type baremetal netid."""
# Create port: --vnic_type baremetal netid.
resource = 'port'
cmd = port.CreatePort(test_cli20.MyApp(sys.stdout), None)
name = 'myname'
@ -213,7 +213,7 @@ class CLITestV20PortJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_create_port_tenant(self):
"""Create port: --tenant_id tenantid netid."""
# Create port: --tenant_id tenantid netid.
resource = 'port'
cmd = port.CreatePort(test_cli20.MyApp(sys.stdout), None)
name = 'myname'
@ -234,7 +234,7 @@ class CLITestV20PortJSON(test_cli20.CLITestV20Base):
tenant_id='tenantid')
def test_create_port_tags(self):
"""Create port: netid mac_address device_id --tags a b."""
# Create port: netid mac_address device_id --tags a b.
resource = 'port'
cmd = port.CreatePort(test_cli20.MyApp(sys.stdout), None)
name = 'myname'
@ -249,7 +249,7 @@ class CLITestV20PortJSON(test_cli20.CLITestV20Base):
tags=['a', 'b'])
def test_create_port_secgroup(self):
"""Create port: --security-group sg1_id netid."""
# Create port: --security-group sg1_id netid.
resource = 'port'
cmd = port.CreatePort(test_cli20.MyApp(sys.stdout), None)
name = 'myname'
@ -262,11 +262,9 @@ class CLITestV20PortJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_create_port_secgroups(self):
"""Create port: <security_groups> netid
The <security_groups> are
--security-group sg1_id --security-group sg2_id
"""
# Create port: <security_groups> netid
# The <security_groups> are --security-group sg1_id
# --security-group sg2_id
resource = 'port'
cmd = port.CreatePort(test_cli20.MyApp(sys.stdout), None)
name = 'myname'
@ -293,10 +291,8 @@ class CLITestV20PortJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_create_port_secgroups_list(self):
"""Create port: netid <security_groups>
The <security_groups> are
--security-groups list=true sg_id1 sg_id2
"""
# Create port: netid <security_groups>
# The <security_groups> are --security-groups list=true sg_id1 sg_id2
resource = 'port'
cmd = port.CreatePort(test_cli20.MyApp(sys.stdout), None)
name = 'myname'
@ -309,7 +305,7 @@ class CLITestV20PortJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_create_port_with_qos_policy(self):
"""Create port: --qos-policy mypolicy."""
# Create port: --qos-policy mypolicy.
resource = 'port'
cmd = port.CreatePort(test_cli20.MyApp(sys.stdout), None)
name = 'myname'
@ -323,10 +319,9 @@ class CLITestV20PortJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_create_port_with_allowed_address_pair_ipaddr(self):
"""Create port:
--allowed-address-pair ip_address=addr0
--allowed-address-pair ip_address=addr1
"""
# Create port:
# --allowed-address-pair ip_address=addr0
# --allowed-address-pair ip_address=addr1
resource = 'port'
cmd = port.CreatePort(test_cli20.MyApp(sys.stdout), None)
name = 'myname'
@ -346,10 +341,9 @@ class CLITestV20PortJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_create_port_with_allowed_address_pair(self):
"""Create port:
--allowed-address-pair ip_address=addr0,mac_address=mac0
--allowed-address-pair ip_address=addr1,mac_address=mac1
"""
# Create port:
# --allowed-address-pair ip_address=addr0,mac_address=mac0
# --allowed-address-pair ip_address=addr1,mac_address=mac1
resource = 'port'
cmd = port.CreatePort(test_cli20.MyApp(sys.stdout), None)
name = 'myname'
@ -371,7 +365,7 @@ class CLITestV20PortJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_list_ports(self):
"""List ports: -D."""
# List ports: -D.
resources = "ports"
cmd = port.ListPort(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd, True)
@ -382,9 +376,8 @@ class CLITestV20PortJSON(test_cli20.CLITestV20Base):
self._test_list_resources_with_pagination(resources, cmd)
def test_list_ports_sort(self):
"""list ports: --sort-key name --sort-key id --sort-key asc
--sort-key desc
"""
# list ports:
# --sort-key name --sort-key id --sort-key asc --sort-key desc
resources = "ports"
cmd = port.ListPort(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd,
@ -392,32 +385,32 @@ class CLITestV20PortJSON(test_cli20.CLITestV20Base):
sort_dir=["asc", "desc"])
def test_list_ports_limit(self):
"""list ports: -P."""
# list ports: -P.
resources = "ports"
cmd = port.ListPort(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd, page_size=1000)
def test_list_ports_tags(self):
"""List ports: -- --tags a b."""
# List ports: -- --tags a b.
resources = "ports"
cmd = port.ListPort(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd, tags=['a', 'b'])
def test_list_ports_detail_tags(self):
"""List ports: -D -- --tags a b."""
# List ports: -D -- --tags a b.
resources = "ports"
cmd = port.ListPort(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd, detail=True, tags=['a', 'b'])
def test_list_ports_fields(self):
"""List ports: --fields a --fields b -- --fields c d."""
# List ports: --fields a --fields b -- --fields c d.
resources = "ports"
cmd = port.ListPort(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd,
fields_1=['a', 'b'], fields_2=['c', 'd'])
def test_list_ports_with_fixed_ips_in_csv(self):
"""List ports: -f csv."""
# List ports: -f csv.
resources = "ports"
cmd = port.ListPort(test_cli20.MyApp(sys.stdout), None)
fixed_ips = [{"subnet_id": "30422057-d6df-4c90-8314-aefb5e326666",
@ -493,28 +486,28 @@ class CLITestV20PortJSON(test_cli20.CLITestV20Base):
self.assertIn('myid1', _str)
def test_list_router_ports(self):
"""List router ports: -D."""
# List router ports: -D.
resources = "ports"
cmd = port.ListRouterPort(test_cli20.MyApp(sys.stdout), None)
self._test_list_router_port(resources, cmd,
self.test_id, True)
def test_list_router_ports_tags(self):
"""List router ports: -- --tags a b."""
# List router ports: -- --tags a b.
resources = "ports"
cmd = port.ListRouterPort(test_cli20.MyApp(sys.stdout), None)
self._test_list_router_port(resources, cmd,
self.test_id, tags=['a', 'b'])
def test_list_router_ports_detail_tags(self):
"""List router ports: -D -- --tags a b."""
# List router ports: -D -- --tags a b.
resources = "ports"
cmd = port.ListRouterPort(test_cli20.MyApp(sys.stdout), None)
self._test_list_router_port(resources, cmd, self.test_id,
detail=True, tags=['a', 'b'])
def test_list_router_ports_fields(self):
"""List ports: --fields a --fields b -- --fields c d."""
# List ports: --fields a --fields b -- --fields c d.
resources = "ports"
cmd = port.ListRouterPort(test_cli20.MyApp(sys.stdout), None)
self._test_list_router_port(resources, cmd, self.test_id,
@ -522,9 +515,7 @@ class CLITestV20PortJSON(test_cli20.CLITestV20Base):
fields_2=['c', 'd'])
def test_update_port(self):
"""Update port: myid --name myname --admin-state-up False
--tags a b.
"""
# Update port: myid --name myname --admin-state-up False --tags a b.
resource = 'port'
cmd = port.UpdatePort(test_cli20.MyApp(sys.stdout), None)
self._test_update_resource(resource, cmd, 'myid',
@ -554,7 +545,7 @@ class CLITestV20PortJSON(test_cli20.CLITestV20Base):
self._test_update_resource(resource, cmd, myid, args, updatefields)
def test_update_port_extra_dhcp_opts(self):
"""Update port: myid --extra_dhcp_opt."""
# Update port: myid --extra_dhcp_opt.
resource = 'port'
myid = 'myid'
args = [myid,
@ -598,7 +589,7 @@ class CLITestV20PortJSON(test_cli20.CLITestV20Base):
self._test_update_resource(resource, cmd, myid, args, updatefields)
def test_update_port_extra_dhcp_opts_ip_version(self):
"""Update port: myid --extra_dhcp_opt."""
# Update port: myid --extra_dhcp_opt.
resource = 'port'
myid = 'myid'
args = [myid,
@ -622,7 +613,7 @@ class CLITestV20PortJSON(test_cli20.CLITestV20Base):
self._test_update_resource(resource, cmd, myid, args, updatedfields)
def test_update_port_with_qos_policy(self):
"""Update port: myid --qos-policy mypolicy."""
# Update port: myid --qos-policy mypolicy.
resource = 'port'
cmd = port.UpdatePort(test_cli20.MyApp(sys.stdout), None)
self._test_update_resource(resource, cmd, 'myid',
@ -630,7 +621,7 @@ class CLITestV20PortJSON(test_cli20.CLITestV20Base):
{'qos_policy_id': 'mypolicy', })
def test_update_port_with_no_qos_policy(self):
"""Update port: myid --no-qos-policy."""
# Update port: myid --no-qos-policy.
resource = 'port'
cmd = port.UpdatePort(test_cli20.MyApp(sys.stdout), None)
self._test_update_resource(resource, cmd, 'myid',
@ -660,7 +651,7 @@ class CLITestV20PortJSON(test_cli20.CLITestV20Base):
self._test_update_resource(resource, cmd, myid, args, updatedfields)
def test_update_port_security_group_off(self):
"""Update port: --no-security-groups myid."""
# Update port: --no-security-groups myid.
resource = 'port'
cmd = port.UpdatePort(test_cli20.MyApp(sys.stdout), None)
self._test_update_resource(resource, cmd, 'myid',
@ -668,10 +659,9 @@ class CLITestV20PortJSON(test_cli20.CLITestV20Base):
{'security_groups': []})
def test_update_port_allowed_address_pair_ipaddr(self):
"""Update port(ip_address only):
--allowed-address-pairs ip_address=addr0
--allowed-address-pairs ip_address=addr1
"""
# Update port(ip_address only):
# --allowed-address-pairs ip_address=addr0
# --allowed-address-pairs ip_address=addr1
import sys
resource = 'port'
cmd = port.UpdatePort(test_cli20.MyApp(sys.stdout), None)
@ -687,12 +677,9 @@ class CLITestV20PortJSON(test_cli20.CLITestV20Base):
self._test_update_resource(resource, cmd, myid, args, updatefields)
def test_update_port_allowed_address_pair(self):
"""Update port:
--allowed-address-pair
ip_address=addr0,mac_address=mac0
--allowed-address-pair
ip_address_addr1,mac_address=mac1
"""
# Update port:
# --allowed-address-pair ip_address=addr0,mac_address=mac0
# --allowed-address-pair ip_address_addr1,mac_address=mac1
resource = 'port'
cmd = port.UpdatePort(test_cli20.MyApp(sys.stdout), None)
myid = 'myid'
@ -709,7 +696,7 @@ class CLITestV20PortJSON(test_cli20.CLITestV20Base):
self._test_update_resource(resource, cmd, myid, args, updatefields)
def test_update_port_allowed_address_pairs_off(self):
"""Update port: --no-allowed-address-pairs."""
# Update port: --no-allowed-address-pairs.
resource = 'port'
cmd = port.UpdatePort(test_cli20.MyApp(sys.stdout), None)
self._test_update_resource(resource, cmd, 'myid',
@ -717,7 +704,7 @@ class CLITestV20PortJSON(test_cli20.CLITestV20Base):
{'allowed_address_pairs': []})
def test_show_port(self):
"""Show port: --fields id --fields name myid."""
# Show port: --fields id --fields name myid.
resource = 'port'
cmd = port.ShowPort(test_cli20.MyApp(sys.stdout), None)
args = ['--fields', 'id', '--fields', 'name', self.test_id]
@ -725,7 +712,7 @@ class CLITestV20PortJSON(test_cli20.CLITestV20Base):
args, ['id', 'name'])
def test_delete_port(self):
"""Delete port: myid."""
# Delete port: myid.
resource = 'port'
cmd = port.DeletePort(test_cli20.MyApp(sys.stdout), None)
myid = 'myid'

View File

@ -24,7 +24,7 @@ class CLITestV20RBACJSON(test_cli20.CLITestV20Base):
non_admin_status_resources = ['rbac_policy']
def test_create_rbac_policy_with_mandatory_params(self):
"""Create rbac: rbac_object --type network --action access_as_shared"""
# Create rbac: rbac_object --type network --action access_as_shared
resource = 'rbac_policy'
cmd = rbac.CreateRBACPolicy(test_cli20.MyApp(sys.stdout), None)
name = 'rbac_object'
@ -38,8 +38,8 @@ class CLITestV20RBACJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_create_rbac_policy_with_all_params(self):
"""Create rbac: rbac_object --type network """
"""--target-tenant tenant_id --action access_as_external"""
# Create rbac: rbac_object --type network --target-tenant tenant_id
# --action access_as_external
resource = 'rbac_policy'
cmd = rbac.CreateRBACPolicy(test_cli20.MyApp(sys.stdout), None)
name = 'rbac_object'
@ -54,7 +54,7 @@ class CLITestV20RBACJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_create_rbac_policy_with_unicode(self):
"""Create rbac policy u'\u7f51\u7edc'."""
# Create rbac policy u'\u7f51\u7edc'.
resource = 'rbac_policy'
cmd = rbac.CreateRBACPolicy(test_cli20.MyApp(sys.stdout), None)
name = u'\u7f51\u7edc'
@ -69,7 +69,7 @@ class CLITestV20RBACJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_update_rbac_policy(self):
"""rbac-update <rbac-uuid> --target-tenant <other-tenant-uuid>."""
# rbac-update <rbac-uuid> --target-tenant <other-tenant-uuid>.
resource = 'rbac_policy'
cmd = rbac.UpdateRBACPolicy(test_cli20.MyApp(sys.stdout), None)
self._test_update_resource(resource, cmd, 'myid',
@ -77,7 +77,7 @@ class CLITestV20RBACJSON(test_cli20.CLITestV20Base):
{'target_tenant': 'tenant_id', })
def test_delete_rbac_policy(self):
"""rbac-delete my-id."""
# rbac-delete my-id.
resource = 'rbac_policy'
cmd = rbac.DeleteRBACPolicy(test_cli20.MyApp(sys.stdout), None)
my_id = 'myid1'
@ -85,21 +85,21 @@ class CLITestV20RBACJSON(test_cli20.CLITestV20Base):
self._test_delete_resource(resource, cmd, my_id, args)
def test_list_rbac_policies(self):
"""rbac-list."""
# rbac-list.
resources = "rbac_policies"
cmd = rbac.ListRBACPolicy(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd, True)
def test_list_rbac_policies_pagination(self):
"""rbac-list with pagination."""
# rbac-list with pagination.
resources = "rbac_policies"
cmd = rbac.ListRBACPolicy(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources_with_pagination(resources, cmd)
def test_list_rbac_policies_sort(self):
"""sorted list: rbac-list --sort-key name --sort-key id
--sort-key asc --sort-key desc
"""
# sorted list:
# rbac-list --sort-key name --sort-key id --sort-key asc
# --sort-key desc
resources = "rbac_policies"
cmd = rbac.ListRBACPolicy(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd,
@ -107,13 +107,13 @@ class CLITestV20RBACJSON(test_cli20.CLITestV20Base):
sort_dir=["asc", "desc"])
def test_list_rbac_policies_limit(self):
"""size (1000) limited list: rbac-list -P."""
# size (1000) limited list: rbac-list -P.
resources = "rbac_policies"
cmd = rbac.ListRBACPolicy(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd, page_size=1000)
def test_show_rbac_policy(self):
"""rbac-show test_id."""
# rbac-show test_id.
resource = 'rbac_policy'
cmd = rbac.ShowRBACPolicy(test_cli20.MyApp(sys.stdout), None)
args = ['--fields', 'id', self.test_id]

View File

@ -23,7 +23,7 @@ from neutronclient.tests.unit import test_cli20
class CLITestV20RouterJSON(test_cli20.CLITestV20Base):
def test_create_router(self):
"""Create router: router1."""
# Create router: router1.
resource = 'router'
cmd = router.CreateRouter(test_cli20.MyApp(sys.stdout), None)
name = 'router1'
@ -35,7 +35,7 @@ class CLITestV20RouterJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_create_router_tenant(self):
"""Create router: --tenant_id tenantid myname."""
# Create router: --tenant_id tenantid myname.
resource = 'router'
cmd = router.CreateRouter(test_cli20.MyApp(sys.stdout), None)
name = 'myname'
@ -48,7 +48,7 @@ class CLITestV20RouterJSON(test_cli20.CLITestV20Base):
tenant_id='tenantid')
def test_create_router_admin_state(self):
"""Create router: --admin_state_down myname."""
# Create router: --admin_state_down myname.
resource = 'router'
cmd = router.CreateRouter(test_cli20.MyApp(sys.stdout), None)
name = 'myname'
@ -61,7 +61,7 @@ class CLITestV20RouterJSON(test_cli20.CLITestV20Base):
admin_state_up=False)
def _create_router_distributed_or_ha(self, distributed=None, ha=None):
"""Create router: --distributed distributed --ha ha myname."""
# Create router: --distributed distributed --ha ha myname.
resource = 'router'
cmd = router.CreateRouter(test_cli20.MyApp(sys.stdout), None)
name = 'myname'
@ -84,7 +84,7 @@ class CLITestV20RouterJSON(test_cli20.CLITestV20Base):
**expected)
def test_create_router_distributed_True(self):
"""Create router: --distributed=True."""
# Create router: --distributed=True.
self._create_router_distributed_or_ha(distributed='True')
def test_create_router_ha_with_True(self):
@ -100,21 +100,20 @@ class CLITestV20RouterJSON(test_cli20.CLITestV20Base):
self._create_router_distributed_or_ha(ha='false')
def test_create_router_distributed_False(self):
"""Create router: --distributed=False."""
# Create router: --distributed=False.
self._create_router_distributed_or_ha(distributed='False')
def test_create_router_distributed_true(self):
"""Create router: --distributed=true."""
# Create router: --distributed=true.
self._create_router_distributed_or_ha(distributed='true')
def test_create_router_distributed_false(self):
"""Create router: --distributed=false."""
# Create router: --distributed=false.
self._create_router_distributed_or_ha(distributed='false')
def test_create_router_with_az_hint(self):
"""Create router: --availability-zone-hint zone1
--availability-zone-hint zone2.
"""
# Create router: --availability-zone-hint zone1
# --availability-zone-hint zone2.
resource = 'router'
cmd = router.CreateRouter(test_cli20.MyApp(sys.stdout), None)
name = 'myname'
@ -127,7 +126,7 @@ class CLITestV20RouterJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_list_routers_detail(self):
"""list routers: -D."""
# list routers: -D.
resources = "routers"
cmd = router.ListRouter(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd, True)
@ -138,9 +137,8 @@ class CLITestV20RouterJSON(test_cli20.CLITestV20Base):
self._test_list_resources_with_pagination(resources, cmd)
def test_list_routers_sort(self):
"""list routers: --sort-key name --sort-key id --sort-key asc
--sort-key desc
"""
# list routers:
# --sort-key name --sort-key id --sort-key asc --sort-key desc
resources = "routers"
cmd = router.ListRouter(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd,
@ -148,20 +146,20 @@ class CLITestV20RouterJSON(test_cli20.CLITestV20Base):
sort_dir=["asc", "desc"])
def test_list_routers_limit(self):
"""list routers: -P."""
# list routers: -P.
resources = "routers"
cmd = router.ListRouter(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd, page_size=1000)
def test_update_router_exception(self):
"""Update router: myid."""
# Update router: myid.
resource = 'router'
cmd = router.UpdateRouter(test_cli20.MyApp(sys.stdout), None)
self.assertRaises(exceptions.CommandError, self._test_update_resource,
resource, cmd, 'myid', ['myid'], {})
def test_update_router(self):
"""Update router: myid --name myname --tags a b."""
# Update router: myid --name myname --tags a b.
resource = 'router'
cmd = router.UpdateRouter(test_cli20.MyApp(sys.stdout), None)
self._test_update_resource(resource, cmd, 'myid',
@ -170,7 +168,7 @@ class CLITestV20RouterJSON(test_cli20.CLITestV20Base):
)
def test_update_router_admin_state(self):
"""Update router: myid --admin-state-up <True|False>."""
# Update router: myid --admin-state-up <True|False>.
resource = 'router'
cmd = router.UpdateRouter(test_cli20.MyApp(sys.stdout), None)
self._test_update_resource(resource, cmd, 'myid',
@ -191,7 +189,7 @@ class CLITestV20RouterJSON(test_cli20.CLITestV20Base):
)
def test_update_router_distributed(self):
"""Update router: myid --distributed <True|False>."""
# Update router: myid --distributed <True|False>.
resource = 'router'
cmd = router.UpdateRouter(test_cli20.MyApp(sys.stdout), None)
self._test_update_resource(resource, cmd, 'myid',
@ -212,7 +210,7 @@ class CLITestV20RouterJSON(test_cli20.CLITestV20Base):
)
def test_update_router_no_routes(self):
"""Update router: myid --no-routes"""
# Update router: myid --no-routes
resource = 'router'
cmd = router.UpdateRouter(test_cli20.MyApp(sys.stdout), None)
self._test_update_resource(resource, cmd, 'myid',
@ -220,9 +218,7 @@ class CLITestV20RouterJSON(test_cli20.CLITestV20Base):
{'routes': None})
def test_update_router_add_route(self):
"""Update router: myid
--route destination=10.0.3.0/24,nexthop=10.0.0.10
"""
# Update router: myid --route destination=10.0.3.0/24,nexthop=10.0.0.10
resource = 'router'
cmd = router.UpdateRouter(test_cli20.MyApp(sys.stdout), None)
myid = 'myid'
@ -235,11 +231,9 @@ class CLITestV20RouterJSON(test_cli20.CLITestV20Base):
self._test_update_resource(resource, cmd, myid, args, updatefields)
def test_update_router_add_routes(self):
"""Update router: myid
--route destination=10.0.3.0/24,nexthop=10.0.0.10
--route destination=fd7a:1d63:2063::/64,
nexthop=fd7a:1d63:2063:0:f816:3eff:fe0e:a697
"""
# Update router: myid --route destination=10.0.3.0/24,nexthop=10.0.0.10
# --route destination=fd7a:1d63:2063::/64,
# nexthop=fd7a:1d63:2063:0:f816:3eff:fe0e:a697
resource = 'router'
cmd = router.UpdateRouter(test_cli20.MyApp(sys.stdout), None)
myid = 'myid'
@ -257,7 +251,7 @@ class CLITestV20RouterJSON(test_cli20.CLITestV20Base):
self._test_update_resource(resource, cmd, myid, args, updatefields)
def test_update_router_no_routes_with_add_route(self):
"""Update router: --no-routes with --route"""
# Update router: --no-routes with --route
resource = 'router'
cmd = router.UpdateRouter(test_cli20.MyApp(sys.stdout), None)
myid = 'myid'
@ -274,7 +268,7 @@ class CLITestV20RouterJSON(test_cli20.CLITestV20Base):
self.assertEqual(2, actual_error_code)
def test_delete_router(self):
"""Delete router: myid."""
# Delete router: myid.
resource = 'router'
cmd = router.DeleteRouter(test_cli20.MyApp(sys.stdout), None)
myid = 'myid'
@ -282,7 +276,7 @@ class CLITestV20RouterJSON(test_cli20.CLITestV20Base):
self._test_delete_resource(resource, cmd, myid, args)
def test_show_router(self):
"""Show router: myid."""
# Show router: myid.
resource = 'router'
cmd = router.ShowRouter(test_cli20.MyApp(sys.stdout), None)
args = ['--fields', 'id', '--fields', 'name', self.test_id]
@ -305,43 +299,43 @@ class CLITestV20RouterJSON(test_cli20.CLITestV20Base):
body, retval)
def test_add_interface_compat(self):
"""Add interface to router: myid subnetid."""
# Add interface to router: myid subnetid.
cmd = router.AddInterfaceRouter(test_cli20.MyApp(sys.stdout), None)
args = ['myid', 'subnetid']
self._test_add_remove_interface('add', 'subnet', cmd, args)
def test_add_interface_by_subnet(self):
"""Add interface to router: myid subnet=subnetid."""
# Add interface to router: myid subnet=subnetid.
cmd = router.AddInterfaceRouter(test_cli20.MyApp(sys.stdout), None)
args = ['myid', 'subnet=subnetid']
self._test_add_remove_interface('add', 'subnet', cmd, args)
def test_add_interface_by_port(self):
"""Add interface to router: myid port=portid."""
# Add interface to router: myid port=portid.
cmd = router.AddInterfaceRouter(test_cli20.MyApp(sys.stdout), None)
args = ['myid', 'port=portid']
self._test_add_remove_interface('add', 'port', cmd, args)
def test_del_interface_compat(self):
"""Delete interface from router: myid subnetid."""
# Delete interface from router: myid subnetid.
cmd = router.RemoveInterfaceRouter(test_cli20.MyApp(sys.stdout), None)
args = ['myid', 'subnetid']
self._test_add_remove_interface('remove', 'subnet', cmd, args)
def test_del_interface_by_subnet(self):
"""Delete interface from router: myid subnet=subnetid."""
# Delete interface from router: myid subnet=subnetid.
cmd = router.RemoveInterfaceRouter(test_cli20.MyApp(sys.stdout), None)
args = ['myid', 'subnet=subnetid']
self._test_add_remove_interface('remove', 'subnet', cmd, args)
def test_del_interface_by_port(self):
"""Delete interface from router: myid port=portid."""
# Delete interface from router: myid port=portid.
cmd = router.RemoveInterfaceRouter(test_cli20.MyApp(sys.stdout), None)
args = ['myid', 'port=portid']
self._test_add_remove_interface('remove', 'port', cmd, args)
def test_set_gateway(self):
"""Set external gateway for router: myid externalid."""
# Set external gateway for router: myid externalid.
resource = 'router'
cmd = router.SetGatewayRouter(test_cli20.MyApp(sys.stdout), None)
args = ['myid', 'externalid']
@ -352,7 +346,7 @@ class CLITestV20RouterJSON(test_cli20.CLITestV20Base):
)
def test_set_gateway_disable_snat(self):
"""set external gateway for router: myid externalid."""
# set external gateway for router: myid externalid.
resource = 'router'
cmd = router.SetGatewayRouter(test_cli20.MyApp(sys.stdout), None)
args = ['myid', 'externalid', '--disable-snat']
@ -364,7 +358,7 @@ class CLITestV20RouterJSON(test_cli20.CLITestV20Base):
)
def test_set_gateway_external_ip(self):
"""set external gateway for router: myid externalid --fixed-ip ..."""
# set external gateway for router: myid externalid --fixed-ip ...
resource = 'router'
cmd = router.SetGatewayRouter(test_cli20.MyApp(sys.stdout), None)
args = ['myid', 'externalid', '--fixed-ip', 'ip_address=10.0.0.2']
@ -377,7 +371,7 @@ class CLITestV20RouterJSON(test_cli20.CLITestV20Base):
)
def test_set_gateway_external_subnet(self):
"""set external gateway for router: myid externalid --fixed-ip ..."""
# set external gateway for router: myid externalid --fixed-ip ...
resource = 'router'
cmd = router.SetGatewayRouter(test_cli20.MyApp(sys.stdout), None)
args = ['myid', 'externalid', '--fixed-ip', 'subnet_id=mysubnet']
@ -390,7 +384,7 @@ class CLITestV20RouterJSON(test_cli20.CLITestV20Base):
)
def test_remove_gateway(self):
"""Remove external gateway from router: externalid."""
# Remove external gateway from router: externalid.
resource = 'router'
cmd = router.RemoveGatewayRouter(test_cli20.MyApp(sys.stdout), None)
args = ['externalid']

View File

@ -31,7 +31,7 @@ class CLITestV20SecurityGroupsJSON(test_cli20.CLITestV20Base):
non_admin_status_resources = ['security_group', 'security_group_rule']
def test_create_security_group(self):
"""Create security group: webservers."""
# Create security group: webservers.
resource = 'security_group'
cmd = securitygroup.CreateSecurityGroup(
test_cli20.MyApp(sys.stdout), None)
@ -44,7 +44,7 @@ class CLITestV20SecurityGroupsJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_create_security_group_tenant(self):
"""Create security group: webservers."""
# Create security group: webservers.
resource = 'security_group'
cmd = securitygroup.CreateSecurityGroup(
test_cli20.MyApp(sys.stdout), None)
@ -59,7 +59,7 @@ class CLITestV20SecurityGroupsJSON(test_cli20.CLITestV20Base):
tenant_id='tenant_id')
def test_create_security_group_with_description(self):
"""Create security group: webservers."""
# Create security group: webservers.
resource = 'security_group'
cmd = securitygroup.CreateSecurityGroup(
test_cli20.MyApp(sys.stdout), None)
@ -115,7 +115,7 @@ class CLITestV20SecurityGroupsJSON(test_cli20.CLITestV20Base):
args, ['id', 'name'])
def test_delete_security_group(self):
"""Delete security group: myid."""
# Delete security group: myid.
resource = 'security_group'
cmd = securitygroup.DeleteSecurityGroup(
test_cli20.MyApp(sys.stdout), None)
@ -124,7 +124,7 @@ class CLITestV20SecurityGroupsJSON(test_cli20.CLITestV20Base):
self._test_delete_resource(resource, cmd, myid, args)
def test_update_security_group(self):
"""Update security group: myid --name myname --description desc."""
# Update security group: myid --name myname --description desc.
resource = 'security_group'
cmd = securitygroup.UpdateSecurityGroup(
test_cli20.MyApp(sys.stdout), None)
@ -147,7 +147,7 @@ class CLITestV20SecurityGroupsJSON(test_cli20.CLITestV20Base):
)
def test_create_security_group_rule_full(self):
"""Create security group rule."""
# Create security group rule.
resource = 'security_group_rule'
cmd = securitygroup.CreateSecurityGroupRule(
test_cli20.MyApp(sys.stdout), None)
@ -175,7 +175,7 @@ class CLITestV20SecurityGroupsJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_delete_security_group_rule(self):
"""Delete security group rule: myid."""
# Delete security group rule: myid.
resource = 'security_group_rule'
cmd = securitygroup.DeleteSecurityGroupRule(
test_cli20.MyApp(sys.stdout), None)

View File

@ -32,7 +32,7 @@ class CLITestV20SubnetJSON(test_cli20.CLITestV20Base):
super(CLITestV20SubnetJSON, self).setUp(plurals={'tags': 'tag'})
def test_create_subnet(self):
"""Create subnet: --gateway gateway netid cidr."""
# Create subnet: --gateway gateway netid cidr.
resource = 'subnet'
cmd = subnet.CreateSubnet(test_cli20.MyApp(sys.stdout), None)
name = 'myname'
@ -48,7 +48,7 @@ class CLITestV20SubnetJSON(test_cli20.CLITestV20Base):
def test_create_subnet_network_cidr_seperated(self):
# For positional value, network_id and cidr can be separated.
"""Create subnet: --gateway gateway netid cidr."""
# Create subnet: --gateway gateway netid cidr.
resource = 'subnet'
cmd = subnet.CreateSubnet(test_cli20.MyApp(sys.stdout), None)
name = 'myname'
@ -63,7 +63,7 @@ class CLITestV20SubnetJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_create_subnet_with_no_gateway(self):
"""Create subnet: --no-gateway netid cidr."""
# Create subnet: --no-gateway netid cidr.
resource = 'subnet'
cmd = subnet.CreateSubnet(test_cli20.MyApp(sys.stdout), None)
name = 'myname'
@ -77,7 +77,7 @@ class CLITestV20SubnetJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_create_subnet_with_bad_gateway_option(self):
"""Create sbunet: --no-gateway netid cidr."""
# Create sbunet: --no-gateway netid cidr.
resource = 'subnet'
cmd = subnet.CreateSubnet(test_cli20.MyApp(sys.stdout), None)
name = 'myname'
@ -102,7 +102,7 @@ class CLITestV20SubnetJSON(test_cli20.CLITestV20Base):
self._test_create_resource(*args, **params)
def test_create_subnet_with_enable_and_disable_dhcp(self):
"""Create subnet: --enable-dhcp and --disable-dhcp."""
# Create subnet: --enable-dhcp and --disable-dhcp.
resource = 'subnet'
cmd = subnet.CreateSubnet(test_cli20.MyApp(sys.stdout), None)
name = 'myname'
@ -125,7 +125,7 @@ class CLITestV20SubnetJSON(test_cli20.CLITestV20Base):
resource, cmd, name, myid, args, position_names, pos_values)
def test_create_subnet_with_multiple_enable_dhcp(self):
"""Create subnet with multiple --enable-dhcp arguments passed."""
# Create subnet with multiple --enable-dhcp arguments passed.
resource = 'subnet'
cmd = subnet.CreateSubnet(test_cli20.MyApp(sys.stdout), None)
name = 'myname'
@ -151,7 +151,7 @@ class CLITestV20SubnetJSON(test_cli20.CLITestV20Base):
resource, cmd, name, myid, args, position_names, pos_values)
def test_create_subnet_tenant(self):
"""Create subnet: --tenant_id tenantid netid cidr."""
# Create subnet: --tenant_id tenantid netid cidr.
resource = 'subnet'
cmd = subnet.CreateSubnet(test_cli20.MyApp(sys.stdout), None)
name = 'myname'
@ -166,7 +166,7 @@ class CLITestV20SubnetJSON(test_cli20.CLITestV20Base):
tenant_id='tenantid')
def test_create_subnet_tags(self):
"""Create subnet: netid cidr --tags a b."""
# Create subnet: netid cidr --tags a b.
resource = 'subnet'
cmd = subnet.CreateSubnet(test_cli20.MyApp(sys.stdout), None)
name = 'myname'
@ -181,9 +181,8 @@ class CLITestV20SubnetJSON(test_cli20.CLITestV20Base):
tags=['a', 'b'])
def test_create_subnet_allocation_pool(self):
"""Create subnet: --tenant_id tenantid <allocation_pool> netid cidr.
The <allocation_pool> is --allocation_pool start=1.1.1.10,end=1.1.1.20
"""
# Create subnet: --tenant_id tenantid <pool> netid cidr.
# The <pool> is --allocation_pool start=1.1.1.10,end=1.1.1.20
resource = 'subnet'
cmd = subnet.CreateSubnet(test_cli20.MyApp(sys.stdout), None)
name = 'myname'
@ -202,10 +201,9 @@ class CLITestV20SubnetJSON(test_cli20.CLITestV20Base):
tenant_id='tenantid')
def test_create_subnet_allocation_pools(self):
"""Create subnet: --tenant-id tenantid <pools> netid cidr.
The <pools> are --allocation_pool start=1.1.1.10,end=1.1.1.20 and
--allocation_pool start=1.1.1.30,end=1.1.1.40
"""
# Create subnet: --tenant-id tenantid <pools> netid cidr.
# The <pools> are --allocation_pool start=1.1.1.10,end=1.1.1.20 and
# --allocation_pool start=1.1.1.30,end=1.1.1.40
resource = 'subnet'
cmd = subnet.CreateSubnet(test_cli20.MyApp(sys.stdout), None)
name = 'myname'
@ -226,10 +224,9 @@ class CLITestV20SubnetJSON(test_cli20.CLITestV20Base):
tenant_id='tenantid')
def test_create_subnet_host_route(self):
"""Create subnet: --tenant_id tenantid <host_route> netid cidr.
The <host_route> is
--host-route destination=172.16.1.0/24,nexthop=1.1.1.20
"""
# Create subnet: --tenant_id tenantid <host_route> netid cidr.
# The <host_route> is
# --host-route destination=172.16.1.0/24,nexthop=1.1.1.20
resource = 'subnet'
cmd = subnet.CreateSubnet(test_cli20.MyApp(sys.stdout), None)
name = 'myname'
@ -248,11 +245,10 @@ class CLITestV20SubnetJSON(test_cli20.CLITestV20Base):
tenant_id='tenantid')
def test_create_subnet_host_routes(self):
"""Create subnet: --tenant-id tenantid <host_routes> netid cidr.
The <host_routes> are
--host-route destination=172.16.1.0/24,nexthop=1.1.1.20 and
--host-route destination=172.17.7.0/24,nexthop=1.1.1.40
"""
# Create subnet: --tenant-id tenantid <host_routes> netid cidr.
# The <host_routes> are
# --host-route destination=172.16.1.0/24,nexthop=1.1.1.20 and
# --host-route destination=172.17.7.0/24,nexthop=1.1.1.40
resource = 'subnet'
cmd = subnet.CreateSubnet(test_cli20.MyApp(sys.stdout), None)
name = 'myname'
@ -273,10 +269,9 @@ class CLITestV20SubnetJSON(test_cli20.CLITestV20Base):
tenant_id='tenantid')
def test_create_subnet_dns_nameservers(self):
"""Create subnet: --tenant-id tenantid <dns-nameservers> netid cidr.
The <dns-nameservers> are
--dns-nameserver 1.1.1.20 and --dns-nameserver 1.1.1.40
"""
# Create subnet: --tenant-id tenantid <dns-nameservers> netid cidr.
# The <dns-nameservers> are
# --dns-nameserver 1.1.1.20 and --dns-nameserver 1.1.1.40
resource = 'subnet'
cmd = subnet.CreateSubnet(test_cli20.MyApp(sys.stdout), None)
name = 'myname'
@ -296,7 +291,7 @@ class CLITestV20SubnetJSON(test_cli20.CLITestV20Base):
tenant_id='tenantid')
def test_create_subnet_with_disable_dhcp(self):
"""Create subnet: --tenant-id tenantid --disable-dhcp netid cidr."""
# Create subnet: --tenant-id tenantid --disable-dhcp netid cidr.
resource = 'subnet'
cmd = subnet.CreateSubnet(test_cli20.MyApp(sys.stdout), None)
name = 'myname'
@ -375,7 +370,7 @@ class CLITestV20SubnetJSON(test_cli20.CLITestV20Base):
tenant_id='tenantid')
def test_create_subnet_max_v4_cidr(self):
"""Create subnet: --gateway gateway netid cidr."""
# Create subnet: --gateway gateway netid cidr.
resource = 'subnet'
cmd = subnet.CreateSubnet(test_cli20.MyApp(sys.stdout), None)
name = 'myname'
@ -563,25 +558,25 @@ class CLITestV20SubnetJSON(test_cli20.CLITestV20Base):
no_api_call=True, expected_exception=exceptions.CommandError)
def test_list_subnets_detail(self):
"""List subnets: -D."""
# List subnets: -D.
resources = "subnets"
cmd = subnet.ListSubnet(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd, True)
def test_list_subnets_tags(self):
"""List subnets: -- --tags a b."""
# List subnets: -- --tags a b.
resources = "subnets"
cmd = subnet.ListSubnet(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd, tags=['a', 'b'])
def test_list_subnets_detail_tags(self):
"""List subnets: -D -- --tags a b."""
# List subnets: -D -- --tags a b.
resources = "subnets"
cmd = subnet.ListSubnet(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd, detail=True, tags=['a', 'b'])
def test_list_subnets_fields(self):
"""List subnets: --fields a --fields b -- --fields c d."""
# List subnets: --fields a --fields b -- --fields c d.
resources = "subnets"
cmd = subnet.ListSubnet(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd,
@ -593,9 +588,8 @@ class CLITestV20SubnetJSON(test_cli20.CLITestV20Base):
self._test_list_resources_with_pagination(resources, cmd)
def test_list_subnets_sort(self):
"""List subnets: --sort-key name --sort-key id --sort-key asc
--sort-key desc
"""
# List subnets: --sort-key name --sort-key id --sort-key asc
# --sort-key desc
resources = "subnets"
cmd = subnet.ListSubnet(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd,
@ -603,13 +597,13 @@ class CLITestV20SubnetJSON(test_cli20.CLITestV20Base):
sort_dir=["asc", "desc"])
def test_list_subnets_limit(self):
"""List subnets: -P."""
# List subnets: -P.
resources = "subnets"
cmd = subnet.ListSubnet(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd, page_size=1000)
def test_update_subnet(self):
"""Update subnet: myid --name myname --tags a b."""
# Update subnet: myid --name myname --tags a b.
resource = 'subnet'
cmd = subnet.UpdateSubnet(test_cli20.MyApp(sys.stdout), None)
self._test_update_resource(resource, cmd, 'myid',
@ -619,7 +613,7 @@ class CLITestV20SubnetJSON(test_cli20.CLITestV20Base):
)
def test_update_subnet_allocation_pools(self):
"""Update subnet: myid --name myname --tags a b."""
# Update subnet: myid --name myname --tags a b.
resource = 'subnet'
cmd = subnet.UpdateSubnet(test_cli20.MyApp(sys.stdout), None)
self._test_update_resource(resource, cmd, 'myid',
@ -630,7 +624,7 @@ class CLITestV20SubnetJSON(test_cli20.CLITestV20Base):
)
def test_update_subnet_enable_disable_dhcp(self):
"""Update sbunet: --enable-dhcp and --disable-dhcp."""
# Update sbunet: --enable-dhcp and --disable-dhcp.
resource = 'subnet'
cmd = subnet.UpdateSubnet(test_cli20.MyApp(sys.stdout), None)
try:
@ -644,7 +638,7 @@ class CLITestV20SubnetJSON(test_cli20.CLITestV20Base):
self.fail('No exception for --enable-dhcp --disable-dhcp option')
def test_show_subnet(self):
"""Show subnet: --fields id --fields name myid."""
# Show subnet: --fields id --fields name myid.
resource = 'subnet'
cmd = subnet.ShowSubnet(test_cli20.MyApp(sys.stdout), None)
args = ['--fields', 'id', '--fields', 'name', self.test_id]
@ -652,7 +646,7 @@ class CLITestV20SubnetJSON(test_cli20.CLITestV20Base):
args, ['id', 'name'])
def test_delete_subnet(self):
"""Delete subnet: subnetid."""
# Delete subnet: subnetid.
resource = 'subnet'
cmd = subnet.DeleteSubnet(test_cli20.MyApp(sys.stdout), None)
myid = 'myid'

View File

@ -31,7 +31,7 @@ class CLITestV20SubnetPoolJSON(test_cli20.CLITestV20Base):
super(CLITestV20SubnetPoolJSON, self).setUp(plurals={'tags': 'tag'})
def test_create_subnetpool_shared(self):
"""Create subnetpool: myname."""
# Create subnetpool: myname.
resource = 'subnetpool'
cmd = subnetpool.CreateSubnetPool(test_cli20.MyApp(sys.stdout), None)
name = 'myname'
@ -48,7 +48,7 @@ class CLITestV20SubnetPoolJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_create_subnetpool_not_shared(self):
"""Create subnetpool: myname."""
# Create subnetpool: myname.
resource = 'subnetpool'
cmd = subnetpool.CreateSubnetPool(test_cli20.MyApp(sys.stdout), None)
name = 'myname'
@ -64,7 +64,7 @@ class CLITestV20SubnetPoolJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_create_subnetpool_with_unicode(self):
"""Create subnetpool: u'\u7f51\u7edc'."""
# Create subnetpool: u'\u7f51\u7edc'.
resource = 'subnetpool'
cmd = subnetpool.CreateSubnetPool(test_cli20.MyApp(sys.stdout), None)
name = u'\u7f51\u7edc'
@ -79,7 +79,7 @@ class CLITestV20SubnetPoolJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_create_subnetpool_with_addrscope(self):
"""Create subnetpool: myname in addrscope: foo-address-scope"""
# Create subnetpool: myname in addrscope: foo-address-scope
resource = 'subnetpool'
cmd = subnetpool.CreateSubnetPool(test_cli20.MyApp(sys.stdout), None)
name = 'myname'
@ -107,9 +107,8 @@ class CLITestV20SubnetPoolJSON(test_cli20.CLITestV20Base):
self.mox.UnsetStubs()
def test_list_subnetpools_sort(self):
"""List subnetpools: --sort-key name --sort-key id --sort-key asc
--sort-key desc
"""
# List subnetpools:
# --sort-key name --sort-key id --sort-key asc --sort-key desc
resources = "subnetpools"
cmd = subnetpool.ListSubnetPool(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd,
@ -117,20 +116,20 @@ class CLITestV20SubnetPoolJSON(test_cli20.CLITestV20Base):
sort_dir=["asc", "desc"])
def test_list_subnetpools_limit(self):
"""List subnetpools: -P."""
# List subnetpools: -P.
resources = "subnetpools"
cmd = subnetpool.ListSubnetPool(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd, page_size=1000)
def test_update_subnetpool_exception(self):
"""Update subnetpool: myid."""
# Update subnetpool: myid.
resource = 'subnetpool'
cmd = subnetpool.UpdateSubnetPool(test_cli20.MyApp(sys.stdout), None)
self.assertRaises(exceptions.CommandError, self._test_update_resource,
resource, cmd, 'myid', ['myid'], {})
def test_update_subnetpool(self):
"""Update subnetpool: myid --name myname."""
# Update subnetpool: myid --name myname.
resource = 'subnetpool'
cmd = subnetpool.UpdateSubnetPool(test_cli20.MyApp(sys.stdout), None)
self._test_update_resource(resource, cmd, 'myid',
@ -139,7 +138,7 @@ class CLITestV20SubnetPoolJSON(test_cli20.CLITestV20Base):
)
def test_update_subnetpool_with_address_scope(self):
"""Update subnetpool: myid --address-scope newscope."""
# Update subnetpool: myid --address-scope newscope.
resource = 'subnetpool'
cmd = subnetpool.UpdateSubnetPool(test_cli20.MyApp(sys.stdout), None)
self._test_update_resource(resource, cmd, 'myid',
@ -148,7 +147,7 @@ class CLITestV20SubnetPoolJSON(test_cli20.CLITestV20Base):
)
def test_update_subnetpool_with_no_address_scope(self):
"""Update subnetpool: myid --no-address-scope."""
# Update subnetpool: myid --no-address-scope.
resource = 'subnetpool'
cmd = subnetpool.UpdateSubnetPool(test_cli20.MyApp(sys.stdout), None)
self._test_update_resource(resource, cmd, 'myid',
@ -157,7 +156,7 @@ class CLITestV20SubnetPoolJSON(test_cli20.CLITestV20Base):
)
def test_show_subnetpool(self):
"""Show subnetpool: --fields id --fields name myid."""
# Show subnetpool: --fields id --fields name myid.
resource = 'subnetpool'
cmd = subnetpool.ShowSubnetPool(test_cli20.MyApp(sys.stdout), None)
args = ['--fields', 'id', '--fields', 'name', self.test_id]
@ -165,7 +164,7 @@ class CLITestV20SubnetPoolJSON(test_cli20.CLITestV20Base):
['id', 'name'])
def test_delete_subnetpool(self):
"""Delete subnetpool: subnetpoolid."""
# Delete subnetpool: subnetpoolid.
resource = 'subnetpool'
cmd = subnetpool.DeleteSubnetPool(test_cli20.MyApp(sys.stdout), None)
myid = 'myid'

View File

@ -68,7 +68,7 @@ class CLITestV20ExtensionJSON(test_cli20.CLITestV20Base):
self.assertTrue(cmdcls.__doc__.startswith("[_fox_sockets]"))
def test_delete_fox_socket(self):
"""Delete fox socket: myid."""
# Delete fox socket: myid.
resource = 'fox_socket'
cmd = fox_sockets.FoxInSocketsDelete(test_cli20.MyApp(sys.stdout),
None)
@ -77,7 +77,7 @@ class CLITestV20ExtensionJSON(test_cli20.CLITestV20Base):
self._test_delete_resource(resource, cmd, myid, args)
def test_update_fox_socket(self):
"""Update fox_socket: myid --name myname."""
# Update fox_socket: myid --name myname.
resource = 'fox_socket'
cmd = fox_sockets.FoxInSocketsUpdate(test_cli20.MyApp(sys.stdout),
None)
@ -86,7 +86,7 @@ class CLITestV20ExtensionJSON(test_cli20.CLITestV20Base):
{'name': 'myname'})
def test_create_fox_socket(self):
"""Create fox_socket: myname."""
# Create fox_socket: myname.
resource = 'fox_socket'
cmd = fox_sockets.FoxInSocketsCreate(test_cli20.MyApp(sys.stdout),
None)
@ -99,13 +99,13 @@ class CLITestV20ExtensionJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_list_fox_sockets(self):
"""List fox_sockets."""
# List fox_sockets.
resources = 'fox_sockets'
cmd = fox_sockets.FoxInSocketsList(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd, True)
def test_show_fox_socket(self):
"""Show fox_socket: --fields id --fields name myid."""
# Show fox_socket: --fields id --fields name myid.
resource = 'fox_socket'
cmd = fox_sockets.FoxInSocketsShow(test_cli20.MyApp(sys.stdout), None)
args = ['--fields', 'id', '--fields', 'name', self.test_id]
@ -150,7 +150,7 @@ class CLITestV20ExtensionJSONAlternatePlurals(test_cli20.CLITestV20Base):
self.assertDictContainsSubset(ext_cmd, shell.COMMANDS['2.0'])
def test_list_ip_addresses(self):
"""List ip_addresses."""
# List ip_addresses.
resources = 'ip_addresses'
cmd = self.IPAddressesList(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd, True)

View File

@ -44,7 +44,7 @@ class TestHTTPClientMixin(object):
"""Return client class, instance."""
def _test_headers(self, expected_headers, **kwargs):
"""Test headers."""
# Test headers.
self.requests.register_uri(METHOD, URL,
request_headers=expected_headers)
self.http.request(URL, METHOD, **kwargs)

View File

@ -27,7 +27,7 @@ class CLITestV20VpnEndpointGroupJSON(test_cli20.CLITestV20Base):
self.register_non_admin_status_resource('endpoint_group')
def test_create_endpoint_group_with_cidrs(self):
"""vpn-endpoint-group-create with CIDR endpoints."""
# vpn-endpoint-group-create with CIDR endpoints."""
resource = 'endpoint_group'
cmd = endpoint_group.CreateEndpointGroup(test_cli20.MyApp(sys.stdout),
None)
@ -55,7 +55,7 @@ class CLITestV20VpnEndpointGroupJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_create_endpoint_group_with_subnets(self):
"""vpn-endpoint-group-create with subnet endpoints."""
# vpn-endpoint-group-create with subnet endpoints."""
resource = 'endpoint_group'
cmd = endpoint_group.CreateEndpointGroup(test_cli20.MyApp(sys.stdout),
None)
@ -77,23 +77,22 @@ class CLITestV20VpnEndpointGroupJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_list_endpoint_group(self):
"""vpn-endpoint-group-list."""
# vpn-endpoint-group-list.
resources = "endpoint_groups"
cmd = endpoint_group.ListEndpointGroup(test_cli20.MyApp(sys.stdout),
None)
self._test_list_resources(resources, cmd, True)
def test_list_endpoint_group_pagination(self):
"""vpn-endpoint-group-list."""
# vpn-endpoint-group-list.
resources = "endpoint_groups"
cmd = endpoint_group.ListEndpointGroup(test_cli20.MyApp(sys.stdout),
None)
self._test_list_resources_with_pagination(resources, cmd)
def test_list_endpoint_group_sort(self):
"""vpn-endpoint-group-list --sort-key name --sort-key id
--sort-key asc --sort-key desc
"""
# vpn-endpoint-group-list --sort-key name --sort-key id
# --sort-key asc --sort-key desc
resources = "endpoint_groups"
cmd = endpoint_group.ListEndpointGroup(test_cli20.MyApp(sys.stdout),
None)
@ -102,14 +101,14 @@ class CLITestV20VpnEndpointGroupJSON(test_cli20.CLITestV20Base):
sort_dir=["asc", "desc"])
def test_list_endpoint_group_limit(self):
"""vpn-endpoint-group-list -P."""
# vpn-endpoint-group-list -P.
resources = "endpoint_groups"
cmd = endpoint_group.ListEndpointGroup(test_cli20.MyApp(sys.stdout),
None)
self._test_list_resources(resources, cmd, page_size=1000)
def test_show_endpoint_group_id(self):
"""vpn-endpoint-group-show test_id."""
# vpn-endpoint-group-show test_id.
resource = 'endpoint_group'
cmd = endpoint_group.ShowEndpointGroup(test_cli20.MyApp(sys.stdout),
None)
@ -117,7 +116,7 @@ class CLITestV20VpnEndpointGroupJSON(test_cli20.CLITestV20Base):
self._test_show_resource(resource, cmd, self.test_id, args, ['id'])
def test_show_endpoint_group_id_name(self):
"""vpn-endpoint-group-show."""
# vpn-endpoint-group-show.
resource = 'endpoint_group'
cmd = endpoint_group.ShowEndpointGroup(test_cli20.MyApp(sys.stdout),
None)
@ -126,9 +125,7 @@ class CLITestV20VpnEndpointGroupJSON(test_cli20.CLITestV20Base):
args, ['id', 'name'])
def test_update_endpoint_group(self):
"""vpn-endpoint-group-update myid --name newname
--description newdesc.
"""
# vpn-endpoint-group-update myid --name newname --description newdesc.
resource = 'endpoint_group'
cmd = endpoint_group.UpdateEndpointGroup(test_cli20.MyApp(sys.stdout),
None)
@ -139,7 +136,7 @@ class CLITestV20VpnEndpointGroupJSON(test_cli20.CLITestV20Base):
'description': 'newdesc'})
def test_delete_endpoint_group(self):
"""vpn-endpoint-group-delete my-id."""
# vpn-endpoint-group-delete my-id.
resource = 'endpoint_group'
cmd = endpoint_group.DeleteEndpointGroup(test_cli20.MyApp(sys.stdout),
None)

View File

@ -25,7 +25,7 @@ class CLITestV20VpnIkePolicyJSON(test_cli20.CLITestV20Base):
non_admin_status_resources = ['ikepolicy']
def test_create_ikepolicy_all_params(self):
"""vpn-ikepolicy-create all params."""
# vpn-ikepolicy-create all params.
resource = 'ikepolicy'
cmd = ikepolicy.CreateIKEPolicy(test_cli20.MyApp(sys.stdout), None)
name = 'ikepolicy1'
@ -71,7 +71,7 @@ class CLITestV20VpnIkePolicyJSON(test_cli20.CLITestV20Base):
extra_body=extra_body)
def test_create_ikepolicy_with_limited_params(self):
"""vpn-ikepolicy-create with limited params."""
# vpn-ikepolicy-create with limited params.
resource = 'ikepolicy'
cmd = ikepolicy.CreateIKEPolicy(test_cli20.MyApp(sys.stdout), None)
name = 'ikepolicy1'
@ -150,21 +150,20 @@ class CLITestV20VpnIkePolicyJSON(test_cli20.CLITestV20Base):
self._test_lifetime_values(lifetime)
def test_list_ikepolicy(self):
"""vpn-ikepolicy-list."""
# vpn-ikepolicy-list.
resources = "ikepolicies"
cmd = ikepolicy.ListIKEPolicy(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd, True)
def test_list_ikepolicy_pagination(self):
"""vpn-ikepolicy-list."""
# vpn-ikepolicy-list.
resources = "ikepolicies"
cmd = ikepolicy.ListIKEPolicy(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources_with_pagination(resources, cmd)
def test_list_ikepolicy_sort(self):
"""vpn-ikepolicy-list --sort-key name --sort-key id --sort-key asc
--sort-key desc
"""
# vpn-ikepolicy-list --sort-key name --sort-key id --sort-key asc
# --sort-key desc
resources = "ikepolicies"
cmd = ikepolicy.ListIKEPolicy(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd,
@ -172,20 +171,20 @@ class CLITestV20VpnIkePolicyJSON(test_cli20.CLITestV20Base):
sort_dir=["asc", "desc"])
def test_list_ikepolicy_limit(self):
"""vpn-ikepolicy-list -P."""
# vpn-ikepolicy-list -P.
resources = "ikepolicies"
cmd = ikepolicy.ListIKEPolicy(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd, page_size=1000)
def test_show_ikepolicy_id(self):
"""vpn-ikepolicy-show ikepolicy_id."""
# vpn-ikepolicy-show ikepolicy_id.
resource = 'ikepolicy'
cmd = ikepolicy.ShowIKEPolicy(test_cli20.MyApp(sys.stdout), None)
args = ['--fields', 'id', self.test_id]
self._test_show_resource(resource, cmd, self.test_id, args, ['id'])
def test_show_ikepolicy_id_name(self):
"""vpn-ikepolicy-show."""
# vpn-ikepolicy-show.
resource = 'ikepolicy'
cmd = ikepolicy.ShowIKEPolicy(test_cli20.MyApp(sys.stdout), None)
args = ['--fields', 'id', '--fields', 'name', self.test_id]
@ -193,7 +192,7 @@ class CLITestV20VpnIkePolicyJSON(test_cli20.CLITestV20Base):
args, ['id', 'name'])
def test_update_ikepolicy(self):
"""vpn-ikepolicy-update myid --name newname --tags a b."""
# vpn-ikepolicy-update myid --name newname --tags a b.
resource = 'ikepolicy'
cmd = ikepolicy.UpdateIKEPolicy(test_cli20.MyApp(sys.stdout), None)
self._test_update_resource(resource, cmd, 'myid',
@ -201,7 +200,7 @@ class CLITestV20VpnIkePolicyJSON(test_cli20.CLITestV20Base):
{'name': 'newname', })
def test_delete_ikepolicy(self):
"""vpn-ikepolicy-delete my-id."""
# vpn-ikepolicy-delete my-id.
resource = 'ikepolicy'
cmd = ikepolicy.DeleteIKEPolicy(test_cli20.MyApp(sys.stdout), None)
my_id = 'my-id'

View File

@ -25,7 +25,7 @@ class CLITestV20IPsecSiteConnectionJSON(test_cli20.CLITestV20Base):
# TODO(pcm): Remove, once peer-cidr is deprecated completely
def test_create_ipsec_site_connection_all_params_using_peer_cidrs(self):
"""ipsecsite-connection-create all params using peer CIDRs."""
# ipsecsite-connection-create all params using peer CIDRs.
resource = 'ipsec_site_connection'
cmd = ipsec_site_connection.CreateIPsecSiteConnection(
test_cli20.MyApp(sys.stdout), None
@ -80,7 +80,7 @@ class CLITestV20IPsecSiteConnectionJSON(test_cli20.CLITestV20Base):
extra_body=extra_body)
def test_create_ipsec_site_conn_all_params(self):
"""ipsecsite-connection-create all params using endpoint groups."""
# ipsecsite-connection-create all params using endpoint groups.
resource = 'ipsec_site_connection'
cmd = ipsec_site_connection.CreateIPsecSiteConnection(
test_cli20.MyApp(sys.stdout), None
@ -137,7 +137,7 @@ class CLITestV20IPsecSiteConnectionJSON(test_cli20.CLITestV20Base):
extra_body=extra_body)
def test_create_ipsec_site_connection_with_limited_params(self):
"""ipsecsite-connection-create with limited params."""
# ipsecsite-connection-create with limited params.
resource = 'ipsec_site_connection'
cmd = ipsec_site_connection.CreateIPsecSiteConnection(
test_cli20.MyApp(sys.stdout), None
@ -181,7 +181,7 @@ class CLITestV20IPsecSiteConnectionJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def _test_create_failure(self, additional_args=None):
"""Helper to test failure of IPSec site-to-site creation failure."""
# Helper to test failure of IPSec site-to-site creation failure.
resource = 'ipsec_site_connection'
cmd = ipsec_site_connection.CreateIPsecSiteConnection(
test_cli20.MyApp(sys.stdout), None
@ -221,7 +221,7 @@ class CLITestV20IPsecSiteConnectionJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_fail_create_with_invalid_mtu(self):
"""ipsecsite-connection-create with invalid dpd values."""
# ipsecsite-connection-create with invalid dpd values.
bad_mtu = ['--mtu', '67']
self._test_create_failure(bad_mtu)
@ -234,26 +234,26 @@ class CLITestV20IPsecSiteConnectionJSON(test_cli20.CLITestV20Base):
self._test_create_failure(bad_dpd_values)
def test_fail_create_missing_endpoint_groups_or_cidr(self):
"""Must provide either endpoint groups or peer cidrs."""
# Must provide either endpoint groups or peer cidrs.
self._test_create_failure()
def test_fail_create_missing_peer_endpoint_group(self):
"""Fails if dont have both endpoint groups - missing peer."""
# Fails if dont have both endpoint groups - missing peer.
self._test_create_failure(['--local-ep-group', 'local-epg'])
def test_fail_create_missing_local_endpoint_group(self):
"""Fails if dont have both endpoint groups - missing local."""
# Fails if dont have both endpoint groups - missing local.
self._test_create_failure(['--peer-ep-group', 'peer-epg'])
def test_fail_create_when_both_endpoints_and_peer_cidr(self):
"""Cannot intermix endpoint groups and peer CIDRs for create."""
# Cannot intermix endpoint groups and peer CIDRs for create.
additional_args = ['--local-ep-group', 'local-epg',
'--peer-ep-group', 'peer-epg',
'--peer-cidr', '10.2.0.0/24']
self._test_create_failure(additional_args)
def test_list_ipsec_site_connection(self):
"""ipsecsite-connection-list."""
# ipsecsite-connection-list.
resources = "ipsec_site_connections"
cmd = ipsec_site_connection.ListIPsecSiteConnection(
test_cli20.MyApp(sys.stdout), None
@ -261,7 +261,7 @@ class CLITestV20IPsecSiteConnectionJSON(test_cli20.CLITestV20Base):
self._test_list_resources(resources, cmd, True)
def test_list_ipsec_site_connection_pagination(self):
"""ipsecsite-connection-list."""
# ipsecsite-connection-list.
resources = "ipsec_site_connections"
cmd = ipsec_site_connection.ListIPsecSiteConnection(
test_cli20.MyApp(sys.stdout), None
@ -269,9 +269,8 @@ class CLITestV20IPsecSiteConnectionJSON(test_cli20.CLITestV20Base):
self._test_list_resources_with_pagination(resources, cmd)
def test_list_ipsec_site_connection_sort(self):
"""ipsecsite-connection-list.
--sort-key name --sort-key id --sort-key asc --sort-key desc
"""
# ipsecsite-connection-list.
# --sort-key name --sort-key id --sort-key asc --sort-key desc
resources = "ipsec_site_connections"
cmd = ipsec_site_connection.ListIPsecSiteConnection(
test_cli20.MyApp(sys.stdout), None
@ -281,7 +280,7 @@ class CLITestV20IPsecSiteConnectionJSON(test_cli20.CLITestV20Base):
sort_dir=["asc", "desc"])
def test_list_ipsec_site_connection_limit(self):
"""ipsecsite-connection-list -P."""
# ipsecsite-connection-list -P.
resources = "ipsec_site_connections"
cmd = ipsec_site_connection.ListIPsecSiteConnection(
test_cli20.MyApp(sys.stdout), None
@ -289,7 +288,7 @@ class CLITestV20IPsecSiteConnectionJSON(test_cli20.CLITestV20Base):
self._test_list_resources(resources, cmd, page_size=1000)
def test_delete_ipsec_site_connection(self):
"""ipsecsite-connection-delete my-id."""
# ipsecsite-connection-delete my-id.
resource = 'ipsec_site_connection'
cmd = ipsec_site_connection.DeleteIPsecSiteConnection(
test_cli20.MyApp(sys.stdout), None
@ -299,7 +298,7 @@ class CLITestV20IPsecSiteConnectionJSON(test_cli20.CLITestV20Base):
self._test_delete_resource(resource, cmd, my_id, args)
def test_update_ipsec_site_connection(self):
"""ipsecsite-connection-update myid --name myname --tags a b."""
# ipsecsite-connection-update myid --name myname --tags a b."""
resource = 'ipsec_site_connection'
cmd = ipsec_site_connection.UpdateIPsecSiteConnection(
test_cli20.MyApp(sys.stdout), None
@ -311,7 +310,7 @@ class CLITestV20IPsecSiteConnectionJSON(test_cli20.CLITestV20Base):
'tags': ['a', 'b'], })
def test_show_ipsec_site_connection_id(self):
"""ipsecsite-connection-show test_id."""
# ipsecsite-connection-show test_id."""
resource = 'ipsec_site_connection'
cmd = ipsec_site_connection.ShowIPsecSiteConnection(
test_cli20.MyApp(sys.stdout), None
@ -320,7 +319,7 @@ class CLITestV20IPsecSiteConnectionJSON(test_cli20.CLITestV20Base):
self._test_show_resource(resource, cmd, self.test_id, args, ['id'])
def test_show_ipsec_site_connection_id_name(self):
"""ipsecsite-connection-show."""
# ipsecsite-connection-show."""
resource = 'ipsec_site_connection'
cmd = ipsec_site_connection.ShowIPsecSiteConnection(
test_cli20.MyApp(sys.stdout), None

View File

@ -25,7 +25,7 @@ class CLITestV20VpnIpsecPolicyJSON(test_cli20.CLITestV20Base):
non_admin_status_resources = ['ipsecpolicy']
def test_create_ipsecpolicy_all_params(self):
"""vpn-ipsecpolicy-create all params with dashes."""
# vpn-ipsecpolicy-create all params with dashes.
resource = 'ipsecpolicy'
cmd = ipsecpolicy.CreateIPsecPolicy(test_cli20.MyApp(sys.stdout), None)
name = 'ipsecpolicy1'
@ -70,7 +70,7 @@ class CLITestV20VpnIpsecPolicyJSON(test_cli20.CLITestV20Base):
extra_body=extra_body)
def test_create_ipsecpolicy_with_limited_params(self):
"""vpn-ipsecpolicy-create with limited params."""
# vpn-ipsecpolicy-create with limited params.
resource = 'ipsecpolicy'
cmd = ipsecpolicy.CreateIPsecPolicy(test_cli20.MyApp(sys.stdout), None)
name = 'ipsecpolicy1'
@ -147,21 +147,20 @@ class CLITestV20VpnIpsecPolicyJSON(test_cli20.CLITestV20Base):
self._test_lifetime_values(lifetime)
def test_list_ipsecpolicy(self):
"""vpn-ipsecpolicy-list."""
# vpn-ipsecpolicy-list.
resources = "ipsecpolicies"
cmd = ipsecpolicy.ListIPsecPolicy(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd, True)
def test_list_ipsecpolicy_pagination(self):
"""vpn-ipsecpolicy-list."""
# vpn-ipsecpolicy-list.
resources = "ipsecpolicies"
cmd = ipsecpolicy.ListIPsecPolicy(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources_with_pagination(resources, cmd)
def test_list_ipsecpolicy_sort(self):
"""vpn-ipsecpolicy-list --sort-key name --sort-key id --sort-key asc
--sort-key desc
"""
# vpn-ipsecpolicy-list --sort-key name --sort-key id --sort-key asc
# --sort-key desc
resources = "ipsecpolicies"
cmd = ipsecpolicy.ListIPsecPolicy(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd,
@ -169,20 +168,20 @@ class CLITestV20VpnIpsecPolicyJSON(test_cli20.CLITestV20Base):
sort_dir=["asc", "desc"])
def test_list_ipsecpolicy_limit(self):
"""vpn-ipsecpolicy-list -P."""
# vpn-ipsecpolicy-list -P.
resources = "ipsecpolicies"
cmd = ipsecpolicy.ListIPsecPolicy(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd, page_size=1000)
def test_show_ipsecpolicy_id(self):
"""vpn-ipsecpolicy-show ipsecpolicy_id."""
# vpn-ipsecpolicy-show ipsecpolicy_id.
resource = 'ipsecpolicy'
cmd = ipsecpolicy.ShowIPsecPolicy(test_cli20.MyApp(sys.stdout), None)
args = ['--fields', 'id', self.test_id]
self._test_show_resource(resource, cmd, self.test_id, args, ['id'])
def test_show_ipsecpolicy_id_name(self):
"""vpn-ipsecpolicy-show."""
# vpn-ipsecpolicy-show.
resource = 'ipsecpolicy'
cmd = ipsecpolicy.ShowIPsecPolicy(test_cli20.MyApp(sys.stdout), None)
args = ['--fields', 'id', '--fields', 'name', self.test_id]
@ -190,7 +189,7 @@ class CLITestV20VpnIpsecPolicyJSON(test_cli20.CLITestV20Base):
args, ['id', 'name'])
def test_update_ipsecpolicy(self):
"""vpn-ipsecpolicy-update myid --name newname --tags a b."""
# vpn-ipsecpolicy-update myid --name newname --tags a b.
resource = 'ipsecpolicy'
cmd = ipsecpolicy.UpdateIPsecPolicy(test_cli20.MyApp(sys.stdout), None)
self._test_update_resource(resource, cmd, 'myid',
@ -198,7 +197,7 @@ class CLITestV20VpnIpsecPolicyJSON(test_cli20.CLITestV20Base):
{'name': 'newname', })
def test_delete_ipsecpolicy(self):
"""vpn-ipsecpolicy-delete my-id."""
# vpn-ipsecpolicy-delete my-id.
resource = 'ipsecpolicy'
cmd = ipsecpolicy.DeleteIPsecPolicy(test_cli20.MyApp(sys.stdout), None)
my_id = 'my-id'

View File

@ -23,7 +23,7 @@ from neutronclient.tests.unit import test_cli20
class CLITestV20VpnServiceJSON(test_cli20.CLITestV20Base):
def test_create_vpnservice_all_params(self):
"""vpn-service-create all params."""
# vpn-service-create all params.
resource = 'vpnservice'
cmd = vpnservice.CreateVPNService(test_cli20.MyApp(sys.stdout), None)
subnet = 'mysubnet-id'
@ -51,7 +51,7 @@ class CLITestV20VpnServiceJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_create_vpnservice_with_limited_params(self):
"""vpn-service-create with limited params."""
# vpn-service-create with limited params.
resource = 'vpnservice'
cmd = vpnservice.CreateVPNService(test_cli20.MyApp(sys.stdout), None)
subnet = 'mysubnet-id'
@ -74,7 +74,7 @@ class CLITestV20VpnServiceJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_create_vpnservice_without_subnet(self):
"""vpn-service-create with no subnet provided."""
# vpn-service-create with no subnet provided.
resource = 'vpnservice'
cmd = vpnservice.CreateVPNService(test_cli20.MyApp(sys.stdout), None)
router = 'myrouter-id'
@ -95,21 +95,20 @@ class CLITestV20VpnServiceJSON(test_cli20.CLITestV20Base):
position_names, position_values)
def test_list_vpnservice(self):
"""vpn-service-list."""
# vpn-service-list.
resources = "vpnservices"
cmd = vpnservice.ListVPNService(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd, True)
def test_list_vpnservice_pagination(self):
"""vpn-service-list."""
# vpn-service-list.
resources = "vpnservices"
cmd = vpnservice.ListVPNService(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources_with_pagination(resources, cmd)
def test_list_vpnservice_sort(self):
"""vpn-service-list --sort-key name --sort-key id --sort-key asc
--sort-key desc
"""
# vpn-service-list --sort-key name --sort-key id --sort-key asc
# --sort-key desc
resources = "vpnservices"
cmd = vpnservice.ListVPNService(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd,
@ -117,20 +116,20 @@ class CLITestV20VpnServiceJSON(test_cli20.CLITestV20Base):
sort_dir=["asc", "desc"])
def test_list_vpnservice_limit(self):
"""vpn-service-list -P."""
# vpn-service-list -P.
resources = "vpnservices"
cmd = vpnservice.ListVPNService(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd, page_size=1000)
def test_show_vpnservice_id(self):
"""vpn-service-show test_id."""
# vpn-service-show test_id.
resource = 'vpnservice'
cmd = vpnservice.ShowVPNService(test_cli20.MyApp(sys.stdout), None)
args = ['--fields', 'id', self.test_id]
self._test_show_resource(resource, cmd, self.test_id, args, ['id'])
def test_show_vpnservice_id_name(self):
"""vpn-service-show."""
# vpn-service-show."""
resource = 'vpnservice'
cmd = vpnservice.ShowVPNService(test_cli20.MyApp(sys.stdout), None)
args = ['--fields', 'id', '--fields', 'name', self.test_id]
@ -138,7 +137,7 @@ class CLITestV20VpnServiceJSON(test_cli20.CLITestV20Base):
args, ['id', 'name'])
def test_update_vpnservice(self):
"""vpn-service-update myid --name newname --tags a b."""
# vpn-service-update myid --name newname --tags a b.
resource = 'vpnservice'
cmd = vpnservice.UpdateVPNService(test_cli20.MyApp(sys.stdout), None)
self._test_update_resource(resource, cmd, 'myid',
@ -146,7 +145,7 @@ class CLITestV20VpnServiceJSON(test_cli20.CLITestV20Base):
{'name': 'newname', })
def test_delete_vpnservice(self):
"""vpn-service-delete my-id."""
# vpn-service-delete my-id.
resource = 'vpnservice'
cmd = vpnservice.DeleteVPNService(test_cli20.MyApp(sys.stdout), None)
my_id = 'my-id'

View File

@ -88,8 +88,7 @@ def exception_handler_v20(status_code, error_content):
class APIParamsCall(object):
"""A Decorator to add support for format and tenant overriding and filters.
"""
"""A Decorator to support formating and tenant overriding and filters."""
def __init__(self, function):
self.function = function
@ -152,7 +151,6 @@ class ClientBase(object):
nets = neutron.list_networks()
...
"""
# API has no way to report plurals, so we have to hard code them
@ -453,38 +451,32 @@ class Client(ClientBase):
@APIParamsCall
def list_ext(self, path, **_params):
"""Client extension hook for lists.
"""
"""Client extension hook for lists."""
return self.get(path, params=_params)
@APIParamsCall
def show_ext(self, path, id, **_params):
"""Client extension hook for shows.
"""
"""Client extension hook for shows."""
return self.get(path % id, params=_params)
@APIParamsCall
def create_ext(self, path, body=None):
"""Client extension hook for creates.
"""
"""Client extension hook for creates."""
return self.post(path, body=body)
@APIParamsCall
def update_ext(self, path, id, body=None):
"""Client extension hook for updates.
"""
"""Client extension hook for updates."""
return self.put(path % id, body=body)
@APIParamsCall
def delete_ext(self, path, id):
"""Client extension hook for deletes.
"""
"""Client extension hook for deletes."""
return self.delete(path % id)
@APIParamsCall
def get_quotas_tenant(self, **_params):
"""Fetch tenant info in server's context for following quota operation.
"""
"""Fetch tenant info for following quota operation."""
return self.get(self.quota_path % 'tenant', params=_params)
@APIParamsCall

View File

@ -45,8 +45,5 @@ commands = sphinx-build -a -E -d releasenotes/build/doctrees -b html releasenote
downloadcache = ~/cache/pip
[flake8]
# H405 multi line docstring summary not separated with an empty line
# (mutli line docstring is used in unit tests frequently)
ignore = H405
show-source = true
exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,tools