Use correct URI in show schema for datasource table command
This patch changes the command to use datasource id in API request URI. It uses currently datasource name though Congress server expects recieving datasource id in URI. Change-Id: If718d72e2f05672a9774778f3c6935d46e33cd80 Closes-Bug: #1441418
This commit is contained in:
parent
b520516b87
commit
ba67fb2621
|
@ -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,
|
||||
|
|
|
@ -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])
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue