Fix bug in "datasource table schema show"

Unlike "datasource schema show", the table version required you pass
in the ID of the datasource, instead of the name.

Change-Id: I07fee067f33f12530bed185d26ed38ef53d76bd3
This commit is contained in:
Tim Hinrichs 2015-04-17 10:52:49 -07:00
parent b520516b87
commit 61e60b6b38
2 changed files with 8 additions and 3 deletions

View File

@ -149,8 +149,11 @@ class ShowDatasourceTableSchema(lister.Lister):
def take_action(self, parsed_args):
self.log.debug('take_action(%s)' % parsed_args)
client = self.app.client_manager.congressclient
results = client.list_datasources()
datasource_id = utils.get_resource_id_from_name(
parsed_args.datasource_name, results)
data = client.show_datasource_table_schema(
parsed_args.datasource_name,
datasource_id,
parsed_args.table_name)
columns = ['name', 'description']
return (columns,

View File

@ -156,9 +156,11 @@ class TestShowDatasourceTableSchema(common.TestCongressBase):
cmd = datasource.ShowDatasourceTableSchema(self.app, self.namespace)
parsed_args = self.check_parser(cmd, arglist, verifylist)
result = cmd.take_action(parsed_args)
with mock.patch.object(utils, "get_resource_id_from_name",
return_value="id"):
result = cmd.take_action(parsed_args)
lister.assert_called_with(datasource_name, table_name)
lister.assert_called_with("id", table_name)
self.assertEqual(['name', 'description'], result[0])