Skip to content

Commit cf25526

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Return the port column headers expected in the list command"
2 parents 7380fbe + 4dbfc47 commit cf25526

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

openstackclient/network/v2/port.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -943,15 +943,12 @@ def take_action(self, parsed_args):
943943
for item in columns
944944
]
945945

946-
headers, attrs = utils.calculate_header_and_attrs(
947-
column_headers, columns, parsed_args
948-
)
949946
return (
950-
headers,
947+
column_headers,
951948
(
952949
utils.get_item_properties(
953950
s,
954-
attrs,
951+
columns,
955952
formatters=_list_formatters,
956953
)
957954
for s in data

openstackclient/tests/functional/network/v2/test_port.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
import uuid
1414

15+
from tempest.lib import exceptions as tempest_exc
16+
1517
from openstackclient.tests.functional.network.v2 import common
1618

1719

@@ -162,8 +164,16 @@ def test_port_list(self):
162164
id_list = [p['ID'] for p in json_output]
163165
self.assertIn(id1, id_list)
164166
self.assertIn(id2, id_list)
165-
# Check an unknown field exists
166-
self.assertIn('device_id', json_output[0])
167+
# Check an unknown field does not exist
168+
self.assertNotIn('device_id', json_output[0])
169+
170+
# Test list with only unknown fields
171+
exc = self.assertRaises(
172+
tempest_exc.CommandFailed,
173+
self.openstack,
174+
'port list -c device_id',
175+
)
176+
self.assertIn("No recognized column names in ['device_id']", str(exc))
167177

168178
def test_port_set(self):
169179
"""Test create, set, show, delete"""

0 commit comments

Comments
 (0)