Fix True/False to accept Camel and Lower case
There are couple of inconsistency in using the Camelcase and Lower case for 'True/False' options in the python-neutronclient. With this fix it will be consistent across all CLI commands. Change-Id: Ifc08ac326e8130f69f864b05781076951a306fa0
This commit is contained in:
@@ -97,7 +97,8 @@ class CreateFirewallRule(neutronv20.CreateCommand):
|
||||
'a:b).'))
|
||||
parser.add_argument(
|
||||
'--enabled',
|
||||
dest='enabled', choices=['True', 'False'],
|
||||
dest='enabled', metavar='{True,False}',
|
||||
choices=['True', 'true', 'False', 'false'],
|
||||
help=_('Whether to enable or disable this rule.'),
|
||||
default=argparse.SUPPRESS)
|
||||
parser.add_argument(
|
||||
|
||||
@@ -71,7 +71,8 @@ class PacketFilterOptionMixin(object):
|
||||
help=_('Set Admin State Up to false'))
|
||||
else:
|
||||
parser.add_argument(
|
||||
'--admin-state', choices=['True', 'False'],
|
||||
'--admin-state', metavar='{True,False}',
|
||||
choices=['True', 'true', 'False', 'false'],
|
||||
help=_('Set a value of Admin State Up'))
|
||||
|
||||
parser.add_argument(
|
||||
|
||||
@@ -74,8 +74,8 @@ class CreateRouter(neutronV20.CreateCommand):
|
||||
help=_('Create a distributed router.'))
|
||||
parser.add_argument(
|
||||
'--ha',
|
||||
dest='ha',
|
||||
choices=['True', 'False'],
|
||||
dest='ha', metavar='{True,False}',
|
||||
choices=['True', 'true', 'false', 'False'],
|
||||
default=argparse.SUPPRESS,
|
||||
help=_('Create a highly available router.'))
|
||||
|
||||
|
||||
@@ -46,6 +46,12 @@ class CLITestV20FirewallRuleJSON(test_cli20.CLITestV20Base):
|
||||
protocol=protocol, action=action,
|
||||
enabled=enabled, tenant_id=tenant_id)
|
||||
|
||||
def test_create_enabled_firewall_rule_with_mandatory_params_lcase(self):
|
||||
self._test_create_firewall_rule_with_mandatory_params(enabled='true')
|
||||
|
||||
def test_create_disabled_firewall_rule_with_mandatory_params_lcase(self):
|
||||
self._test_create_firewall_rule_with_mandatory_params(enabled='false')
|
||||
|
||||
def test_create_enabled_firewall_rule_with_mandatory_params(self):
|
||||
self._test_create_firewall_rule_with_mandatory_params(enabled='True')
|
||||
|
||||
|
||||
@@ -87,8 +87,17 @@ class CLITestV20RouterJSON(test_cli20.CLITestV20Base):
|
||||
"""Create router: --distributed=True."""
|
||||
self._create_router_distributed_or_ha(distributed='True')
|
||||
|
||||
def test_create_router_ha(self):
|
||||
self._create_router_distributed_or_ha(ha=True)
|
||||
def test_create_router_ha_with_True(self):
|
||||
self._create_router_distributed_or_ha(ha='True')
|
||||
|
||||
def test_create_router_ha_with_true(self):
|
||||
self._create_router_distributed_or_ha(ha='true')
|
||||
|
||||
def test_create_router_ha_with_False(self):
|
||||
self._create_router_distributed_or_ha(ha='False')
|
||||
|
||||
def test_create_router_ha_with_false(self):
|
||||
self._create_router_distributed_or_ha(ha='false')
|
||||
|
||||
def test_create_router_distributed_False(self):
|
||||
"""Create router: --distributed=False."""
|
||||
|
||||
Reference in New Issue
Block a user