diff options
| author | Jas <singhj@us.ibm.com> | 2016-02-04 11:33:13 -0600 |
|---|---|---|
| committer | Jas <singhj@us.ibm.com> | 2016-03-07 11:17:31 -0600 |
| commit | d5489426458e9b4b96772983797263d8807571cb (patch) | |
| tree | e90efcb3bd58dc02af5f7a158a34dc90c0243256 /openstackclient/tests | |
| parent | fc24f37ae28e1b7f6b9587a8062a314d660a0136 (diff) | |
| download | python-openstackclient-d5489426458e9b4b96772983797263d8807571cb.tar.gz | |
Add port list command
This patch adds the ability to list all created ports
Change-Id: Ie1a48c203cabc96346a4950f21b83493d58a66a5
Partial-bug: #1519909
Partially-implements: blueprint neutron-client
Diffstat (limited to 'openstackclient/tests')
| -rw-r--r-- | openstackclient/tests/network/v2/test_port.py | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/openstackclient/tests/network/v2/test_port.py b/openstackclient/tests/network/v2/test_port.py index 907d8a7d..30e290c6 100644 --- a/openstackclient/tests/network/v2/test_port.py +++ b/openstackclient/tests/network/v2/test_port.py @@ -199,6 +199,47 @@ class TestDeletePort(TestPort): self.assertIsNone(result) +class TestListPort(TestPort): + + _ports = network_fakes.FakePort.create_ports(count=3) + + columns = ( + 'ID', + 'Name', + 'MAC Address', + 'Fixed IP Addresses', + ) + + data = [] + for prt in _ports: + data.append(( + prt.id, + prt.name, + prt.mac_address, + utils.format_list_of_dicts(prt.fixed_ips), + )) + + def setUp(self): + super(TestListPort, self).setUp() + + # Get the command object to test + self.cmd = port.ListPort(self.app, self.namespace) + + self.network.ports = mock.Mock(return_value=self._ports) + + def test_port_list_no_options(self): + arglist = [] + verifylist = [] + + parsed_args = self.check_parser(self.cmd, arglist, verifylist) + + columns, data = self.cmd.take_action(parsed_args) + + self.network.ports.assert_called_with() + self.assertEqual(self.columns, columns) + self.assertEqual(self.data, list(data)) + + class TestShowPort(TestPort): # The port to show. |
