diff options
| author | Nam Nguyen Hoai <namnh@vn.fujitsu.com> | 2016-08-18 15:24:51 +0700 |
|---|---|---|
| committer | Dean Troyer <dtroyer@gmail.com> | 2016-10-12 20:40:46 +0000 |
| commit | 2c1282cecf33162b5483f5cb558f98395945380b (patch) | |
| tree | e2e5456aef0c23de33947a6d6876f094438eb770 /openstackclient/tests | |
| parent | ea7f28fb4acd39345bb95809a952e03ed802a9ff (diff) | |
| download | python-openstackclient-2c1282cecf33162b5483f5cb558f98395945380b.tar.gz | |
Add a new column and a new option the 'os port list' cmd
This patch will add a new column called status to the
result of the 'os port list' command and --long option
to 'os port list' command.
Co-Authored-By: Ha Van Tu <tuhv@vn.fujitsu.com>
Change-Id: I4f942414e969687304b578ed7f003dd219c0f2f8
Closes-Bug: #1613995
Closes-Bug: #1614321
Partially-Implements: blueprint network-commands-options
Diffstat (limited to 'openstackclient/tests')
| -rw-r--r-- | openstackclient/tests/unit/network/v2/test_port.py | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/openstackclient/tests/unit/network/v2/test_port.py b/openstackclient/tests/unit/network/v2/test_port.py index a2aceab1..bfc26bf4 100644 --- a/openstackclient/tests/unit/network/v2/test_port.py +++ b/openstackclient/tests/unit/network/v2/test_port.py @@ -317,6 +317,17 @@ class TestListPort(TestPort): 'Name', 'MAC Address', 'Fixed IP Addresses', + 'Status', + ) + + columns_long = ( + 'ID', + 'Name', + 'MAC Address', + 'Fixed IP Addresses', + 'Status', + 'Security Groups', + 'Device Owner', ) data = [] @@ -326,6 +337,19 @@ class TestListPort(TestPort): prt.name, prt.mac_address, utils.format_list_of_dicts(prt.fixed_ips), + prt.status, + )) + + data_long = [] + for prt in _ports: + data_long.append(( + prt.id, + prt.name, + prt.mac_address, + utils.format_list_of_dicts(prt.fixed_ips), + prt.status, + utils.format_list(prt.security_groups), + prt.device_owner, )) def setUp(self): @@ -439,6 +463,23 @@ class TestListPort(TestPort): self.assertEqual(self.columns, columns) self.assertEqual(self.data, list(data)) + def test_list_port_with_long(self): + arglist = [ + '--long', + ] + + verifylist = [ + ('long', True), + ] + + parsed_args = self.check_parser(self.cmd, arglist, verifylist) + + columns, data = self.cmd.take_action(parsed_args) + + self.network.ports.assert_called_once_with() + self.assertEqual(self.columns_long, columns) + self.assertEqual(self.data_long, list(data)) + class TestSetPort(TestPort): |
