Activate the --long option for zone list command
Activate the --long option for openstack zone list command When this option is used, additional columns and values are displayed. The new columns are ttl, pool_id, email, attributes, and masters. Add test code for the new columns. Change-Id: I67262571639623de160688afb3f9f4a9ecb81534
This commit is contained in:
@@ -70,3 +70,22 @@ class TestDesignateListZones(utils.TestCommand):
|
||||
results = list(data)
|
||||
|
||||
self.assertEqual(2, len(results))
|
||||
|
||||
def test_list_zones_with_long_option(self):
|
||||
arg_list = ['--long']
|
||||
verify_args = [('long', True)]
|
||||
|
||||
body = resources.load('zone_list')
|
||||
result = base.DesignateList()
|
||||
result.extend(body['zones'])
|
||||
|
||||
self.dns_client.zones.list.return_value = result
|
||||
|
||||
parsed_args = self.check_parser(self.cmd, arg_list, verify_args)
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.assertIn('ttl', columns)
|
||||
self.assertIn('pool_id', columns)
|
||||
self.assertIn('email', columns)
|
||||
self.assertIn('attributes', columns)
|
||||
self.assertIn('masters', columns)
|
||||
|
@@ -63,6 +63,13 @@ class ListZonesCommand(command.Lister):
|
||||
parser.add_argument('--description', help='Description',
|
||||
required=False)
|
||||
parser.add_argument('--status', help='Zone Status', required=False)
|
||||
parser.add_argument(
|
||||
'--long',
|
||||
help='List additional fields in output',
|
||||
default=False,
|
||||
action='store_true',
|
||||
required=False
|
||||
)
|
||||
|
||||
common.add_all_common_options(parser)
|
||||
|
||||
@@ -95,6 +102,9 @@ class ListZonesCommand(command.Lister):
|
||||
|
||||
cols = list(self.columns)
|
||||
|
||||
if parsed_args.long:
|
||||
cols += ['ttl', 'pool_id', 'email', 'attributes', 'masters']
|
||||
|
||||
if client.session.all_projects:
|
||||
cols.insert(1, 'project_id')
|
||||
|
||||
|
Reference in New Issue
Block a user