TrivialOrder: Rearrange Class Names

As per the comment given by Steve Martinelli in
https://review.openstack.org/#/c/278209/ , the
following patch just rearranges the classes
as per the Alphabetical order.

TrivialFix

Change-Id: Ib8f0f703df4ef7d7ee6180ff8bd8a47062ae5b0f
This commit is contained in:
reedip 2016-03-01 16:11:51 +09:00
parent 0dfc50ea1c
commit a1f2f4af58
3 changed files with 63 additions and 63 deletions

View File

@ -4,6 +4,22 @@ subnet
Network v2 Network v2
subnet delete
-------------
Delete a subnet
.. program:: subnet delete
.. code:: bash
os subnet delete
<subnet>
.. _subnet_delete-subnet:
.. describe:: <subnet>
Subnet to delete (name or ID)
subnet list subnet list
----------- -----------
@ -34,19 +50,3 @@ Show subnet details
.. describe:: <subnet> .. describe:: <subnet>
Subnet to show (name or ID) Subnet to show (name or ID)
subnet delete
-------------
Delete a subnet
.. program:: subnet delete
.. code:: bash
os subnet delete
<subnet>
.. _subnet_delete-subnet:
.. describe:: <subnet>
Subnet to delete (name or ID)

View File

@ -38,6 +38,24 @@ def _get_columns(item):
return tuple(sorted(columns)) return tuple(sorted(columns))
class DeleteSubnet(command.Command):
"""Delete subnet"""
def get_parser(self, prog_name):
parser = super(DeleteSubnet, self).get_parser(prog_name)
parser.add_argument(
'subnet',
metavar="<subnet>",
help="Subnet to delete (name or ID)"
)
return parser
def take_action(self, parsed_args):
client = self.app.client_manager.network
client.delete_subnet(
client.find_subnet(parsed_args.subnet))
class ListSubnet(command.Lister): class ListSubnet(command.Lister):
"""List subnets""" """List subnets"""
@ -89,21 +107,3 @@ class ShowSubnet(command.ShowOne):
columns = _get_columns(obj) columns = _get_columns(obj)
data = utils.get_item_properties(obj, columns, formatters=_formatters) data = utils.get_item_properties(obj, columns, formatters=_formatters)
return (columns, data) return (columns, data)
class DeleteSubnet(command.Command):
"""Delete subnet"""
def get_parser(self, prog_name):
parser = super(DeleteSubnet, self).get_parser(prog_name)
parser.add_argument(
'subnet',
metavar="<subnet>",
help=("Subnet to delete (name or ID)")
)
return parser
def take_action(self, parsed_args):
client = self.app.client_manager.network
client.delete_subnet(
client.find_subnet(parsed_args.subnet))

View File

@ -28,6 +28,35 @@ class TestSubnet(network_fakes.TestNetworkV2):
self.network = self.app.client_manager.network self.network = self.app.client_manager.network
class TestDeleteSubnet(TestSubnet):
# The subnet to delete.
_subnet = network_fakes.FakeSubnet.create_one_subnet()
def setUp(self):
super(TestDeleteSubnet, self).setUp()
self.network.delete_subnet = mock.Mock(return_value=None)
self.network.find_subnet = mock.Mock(return_value=self._subnet)
# Get the command object to test
self.cmd = subnet_v2.DeleteSubnet(self.app, self.namespace)
def test_delete(self):
arglist = [
self._subnet.name,
]
verifylist = [
('subnet', self._subnet.name),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.take_action(parsed_args)
self.network.delete_subnet.assert_called_with(self._subnet)
self.assertIsNone(result)
class TestListSubnet(TestSubnet): class TestListSubnet(TestSubnet):
# The subnets going to be listed up. # The subnets going to be listed up.
_subnet = network_fakes.FakeSubnet.create_subnets(count=3) _subnet = network_fakes.FakeSubnet.create_subnets(count=3)
@ -181,32 +210,3 @@ class TestShowSubnet(TestSubnet):
self.assertEqual(self.columns, columns) self.assertEqual(self.columns, columns)
self.assertEqual(list(self.data), list(data)) self.assertEqual(list(self.data), list(data))
class TestDeleteSubnet(TestSubnet):
# The subnet to delete.
_subnet = network_fakes.FakeSubnet.create_one_subnet()
def setUp(self):
super(TestDeleteSubnet, self).setUp()
self.network.delete_subnet = mock.Mock(return_value=None)
self.network.find_subnet = mock.Mock(return_value=self._subnet)
# Get the command object to test
self.cmd = subnet_v2.DeleteSubnet(self.app, self.namespace)
def test_delete(self):
arglist = [
self._subnet.name,
]
verifylist = [
('subnet', self._subnet.name),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.take_action(parsed_args)
self.network.delete_subnet.assert_called_with(self._subnet)
self.assertIsNone(result)