Merge "Fix bug in "datasource table schema show""

This commit is contained in:
Jenkins 2015-04-21 20:43:19 +00:00 committed by Gerrit Code Review
commit 91b9963d7e
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])