summaryrefslogtreecommitdiff
path: root/quantumclient/tests
diff options
context:
space:
mode:
authorYong Sheng Gong <gongysh@cn.ibm.com>2012-07-05 15:01:39 +0800
committerYong Sheng Gong <gongysh@cn.ibm.com>2012-07-05 15:06:08 +0800
commit1586c923d9dd0a717df07cc1d729fc45d55d3b06 (patch)
tree9353e7b788054c1db3539cc5c2ecc49094c917ba /quantumclient/tests
parentd955740671000b2b915c8c6717d12a5e52f3b89e (diff)
downloadpython-neutronclient-1586c923d9dd0a717df07cc1d729fc45d55d3b06.tar.gz
Make quantum cli consistent with other cli's practice.
Bug 1011759 We use dash in command names, underscore in options or arguments, adopt noun-verb format command names. Change-Id: Ibeb2b4a31929dbb7008cec3b04bd77e75d9ace1a
Diffstat (limited to 'quantumclient/tests')
-rw-r--r--quantumclient/tests/unit/test_cli20_network.py30
-rw-r--r--quantumclient/tests/unit/test_cli20_port.py30
-rw-r--r--quantumclient/tests/unit/test_cli20_subnet.py24
3 files changed, 39 insertions, 45 deletions
diff --git a/quantumclient/tests/unit/test_cli20_network.py b/quantumclient/tests/unit/test_cli20_network.py
index 809419a..69fcd1d 100644
--- a/quantumclient/tests/unit/test_cli20_network.py
+++ b/quantumclient/tests/unit/test_cli20_network.py
@@ -29,7 +29,7 @@ from quantumclient.quantum.v2_0.network import DeleteNetwork
class CLITestV20Network(CLITestV20Base):
def test_create_network(self):
- """ create_net myname"""
+ """Create net: myname."""
resource = 'network'
cmd = CreateNetwork(MyApp(sys.stdout), None)
name = 'myname'
@@ -41,12 +41,12 @@ class CLITestV20Network(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 = CreateNetwork(MyApp(sys.stdout), None)
name = 'myname'
myid = 'myid'
- args = ['--tenant-id', 'tenantid', name]
+ args = ['--tenant_id', 'tenantid', name]
position_names = ['name', ]
position_values = [name, ]
_str = self._test_create_resource(resource, cmd, name, myid, args,
@@ -54,7 +54,7 @@ class CLITestV20Network(CLITestV20Base):
tenant_id='tenantid')
def test_create_network_tags(self):
- """ create_net myname --tags a b"""
+ """Create net: myname --tags a b."""
resource = 'network'
cmd = CreateNetwork(MyApp(sys.stdout), None)
name = 'myname'
@@ -67,12 +67,12 @@ class CLITestV20Network(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 = CreateNetwork(MyApp(sys.stdout), None)
name = 'myname'
myid = 'myid'
- args = ['--admin-state-down', name, ]
+ args = ['--admin_state_down', name, ]
position_names = ['name', ]
position_values = [name, ]
_str = self._test_create_resource(resource, cmd, name, myid, args,
@@ -80,39 +80,39 @@ class CLITestV20Network(CLITestV20Base):
admin_state_up=False)
def test_list_nets_detail(self):
- """list_nets -D"""
+ """list nets: -D."""
resources = "networks"
cmd = ListNetwork(MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd, True)
def test_list_nets_tags(self):
- """list_nets -- --tags a b"""
+ """List nets: -- --tags a b."""
resources = "networks"
cmd = ListNetwork(MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd, tags=['a', 'b'])
def test_list_nets_detail_tags(self):
- """list_nets -D -- --tags a b"""
+ """List nets: -D -- --tags a b."""
resources = "networks"
cmd = ListNetwork(MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd, detail=True, tags=['a', 'b'])
def test_list_nets_fields(self):
- """list_nets --fields a --fields b -- --fields c d"""
+ """List nets: --fields a --fields b -- --fields c d."""
resources = "networks"
cmd = ListNetwork(MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd,
fields_1=['a', 'b'], fields_2=['c', 'd'])
def test_update_network_exception(self):
- """ update_net myid"""
+ """Update net: myid."""
resource = 'network'
cmd = UpdateNetwork(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 = UpdateNetwork(MyApp(sys.stdout), None)
self._test_update_resource(resource, cmd, 'myid',
@@ -122,7 +122,7 @@ class CLITestV20Network(CLITestV20Base):
)
def test_show_network(self):
- """ show_net --fields id --fields name myid """
+ """Show net: --fields id --fields name myid."""
resource = 'network'
cmd = ShowNetwork(MyApp(sys.stdout), None)
myid = 'myid'
@@ -130,9 +130,7 @@ class CLITestV20Network(CLITestV20Base):
self._test_show_resource(resource, cmd, myid, args, ['id', 'name'])
def test_delete_network(self):
- """
- delete_net myid
- """
+ """Delete net: myid."""
resource = 'network'
cmd = DeleteNetwork(MyApp(sys.stdout), None)
myid = 'myid'
diff --git a/quantumclient/tests/unit/test_cli20_port.py b/quantumclient/tests/unit/test_cli20_port.py
index febb69e..427d473 100644
--- a/quantumclient/tests/unit/test_cli20_port.py
+++ b/quantumclient/tests/unit/test_cli20_port.py
@@ -29,7 +29,7 @@ from quantumclient.quantum.v2_0.port import DeletePort
class CLITestV20Port(CLITestV20Base):
def test_create_port(self):
- """ create_port netid"""
+ """Create port: netid."""
resource = 'port'
cmd = CreatePort(MyApp(sys.stdout), None)
name = 'myname'
@@ -43,26 +43,26 @@ class CLITestV20Port(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 = CreatePort(MyApp(sys.stdout), None)
name = 'myname'
myid = 'myid'
netid = 'netid'
- args = ['--mac-address', 'mac', '--device-id', 'deviceid', netid]
+ args = ['--mac_address', 'mac', '--device_id', 'deviceid', netid]
position_names = ['network_id', 'mac_address', 'device_id']
position_values = [netid, 'mac', 'deviceid']
_str = self._test_create_resource(resource, cmd, name, myid, args,
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 = CreatePort(MyApp(sys.stdout), None)
name = 'myname'
myid = 'myid'
netid = 'netid'
- args = ['--tenant-id', 'tenantid', netid, ]
+ args = ['--tenant_id', 'tenantid', netid, ]
position_names = ['network_id']
position_values = []
position_values.extend([netid])
@@ -71,7 +71,7 @@ class CLITestV20Port(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 = CreatePort(MyApp(sys.stdout), None)
name = 'myname'
@@ -85,33 +85,33 @@ class CLITestV20Port(CLITestV20Base):
position_names, position_values,
tags=['a', 'b'])
- def test_list_ports_detail(self):
- """list_ports -D"""
+ def test_list_ports(self):
+ """List ports: -D."""
resources = "ports"
cmd = ListPort(MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd, True)
def test_list_ports_tags(self):
- """list_ports -- --tags a b"""
+ """List ports: -- --tags a b."""
resources = "ports"
cmd = ListPort(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 = ListPort(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 = ListPort(MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd,
fields_1=['a', 'b'], fields_2=['c', 'd'])
def test_update_port(self):
- """ update_port myid --name myname --tags a b"""
+ """Update port: myid --name myname --tags a b."""
resource = 'port'
cmd = UpdatePort(MyApp(sys.stdout), None)
self._test_update_resource(resource, cmd, 'myid',
@@ -121,7 +121,7 @@ class CLITestV20Port(CLITestV20Base):
)
def test_show_port(self):
- """ show_port --fields id --fields name myid """
+ """Show port: --fields id --fields name myid."""
resource = 'port'
cmd = ShowPort(MyApp(sys.stdout), None)
myid = 'myid'
@@ -129,9 +129,7 @@ class CLITestV20Port(CLITestV20Base):
self._test_show_resource(resource, cmd, myid, args, ['id', 'name'])
def test_delete_port(self):
- """
- delete_port myid
- """
+ """Delete port: myid."""
resource = 'port'
cmd = DeletePort(MyApp(sys.stdout), None)
myid = 'myid'
diff --git a/quantumclient/tests/unit/test_cli20_subnet.py b/quantumclient/tests/unit/test_cli20_subnet.py
index 08385ee..1c5d7ae 100644
--- a/quantumclient/tests/unit/test_cli20_subnet.py
+++ b/quantumclient/tests/unit/test_cli20_subnet.py
@@ -29,7 +29,7 @@ from quantumclient.quantum.v2_0.subnet import DeleteSubnet
class CLITestV20Subnet(CLITestV20Base):
def test_create_subnet(self):
- """ create_subnet --gateway gateway netid cidr"""
+ """Create sbunet: --gateway gateway netid cidr."""
resource = 'subnet'
cmd = CreateSubnet(MyApp(sys.stdout), None)
name = 'myname'
@@ -45,14 +45,14 @@ class CLITestV20Subnet(CLITestV20Base):
position_names, position_values)
def test_create_subnet_tenant(self):
- """create_subnet --tenant-id tenantid netid cidr"""
+ """Create subnet: --tenant_id tenantid netid cidr."""
resource = 'subnet'
cmd = CreateSubnet(MyApp(sys.stdout), None)
name = 'myname'
myid = 'myid'
netid = 'netid'
cidr = 'prefixvalue'
- args = ['--tenant-id', 'tenantid', netid, cidr]
+ args = ['--tenant_id', 'tenantid', netid, cidr]
position_names = ['ip_version', 'network_id', 'cidr']
position_values = [4, ]
position_values.extend([netid, cidr])
@@ -61,7 +61,7 @@ class CLITestV20Subnet(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 = CreateSubnet(MyApp(sys.stdout), None)
name = 'myname'
@@ -77,32 +77,32 @@ class CLITestV20Subnet(CLITestV20Base):
tags=['a', 'b'])
def test_list_subnets_detail(self):
- """list_subnets -D"""
+ """List subnets: -D."""
resources = "subnets"
cmd = ListSubnet(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 = ListSubnet(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 = ListSubnet(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 = ListSubnet(MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd,
fields_1=['a', 'b'], fields_2=['c', 'd'])
def test_update_subnet(self):
- """ update_subnet myid --name myname --tags a b"""
+ """Update subnet: myid --name myname --tags a b."""
resource = 'subnet'
cmd = UpdateSubnet(MyApp(sys.stdout), None)
self._test_update_resource(resource, cmd, 'myid',
@@ -112,7 +112,7 @@ class CLITestV20Subnet(CLITestV20Base):
)
def test_show_subnet(self):
- """ show_subnet --fields id --fields name myid """
+ """Show subnet: --fields id --fields name myid."""
resource = 'subnet'
cmd = ShowSubnet(MyApp(sys.stdout), None)
myid = 'myid'
@@ -120,9 +120,7 @@ class CLITestV20Subnet(CLITestV20Base):
self._test_show_resource(resource, cmd, myid, args, ['id', 'name'])
def test_delete_subnet(self):
- """
- delete_subnet myid
- """
+ """Delete subnet: subnetid."""
resource = 'subnet'
cmd = DeleteSubnet(MyApp(sys.stdout), None)
myid = 'myid'