Explicitly specify namespace fields for output

Rather than excluding the few fields we don't want, explicitly indicate
the ones we do want.

Note that this is a problem in the tests for virtually all commands
that will be seen as the SDK continues to evolve and new fields are
added to existing resources.

Change-Id: Ia8d487e1e7804fa177fce46497c0202aed8acb08
This commit is contained in:
Mridula Joshi 2024-01-16 15:14:55 +00:00
parent 4bafc32616
commit 1517f4af21
2 changed files with 3 additions and 15 deletions

View File

@ -42,6 +42,7 @@ def _format_namespace(namespace):
'owner',
'protected',
'schema',
'updated_at',
'visibility',
]
@ -130,8 +131,9 @@ class CreateMetadefNameSpace(command.ShowOne):
kwargs['visibility'] = parsed_args.visibility
data = image_client.create_metadef_namespace(**kwargs)
info = _format_namespace(data)
return zip(*sorted(data.items()))
return zip(*sorted(info.items()))
class DeleteMetadefNameSpace(command.Command):

View File

@ -21,30 +21,16 @@ class TestMetadefNamespaceCreate(image_fakes.TestImagev2):
expected_columns = (
'created_at',
'description',
'display_name',
'id',
'is_protected',
'location',
'name',
'namespace',
'owner',
'resource_type_associations',
'updated_at',
'visibility',
)
expected_data = (
_metadef_namespace.created_at,
_metadef_namespace.description,
_metadef_namespace.display_name,
_metadef_namespace.id,
_metadef_namespace.is_protected,
_metadef_namespace.location,
_metadef_namespace.name,
_metadef_namespace.namespace,
_metadef_namespace.owner,
_metadef_namespace.resource_type_associations,
_metadef_namespace.updated_at,
_metadef_namespace.visibility,
)