From 96931323ab494043ddc93bdd1070312baef7d2a2 Mon Sep 17 00:00:00 2001 From: Masahito Muroi Date: Fri, 15 May 2015 15:14:04 +0000 Subject: [PATCH] Adding a test of datasource table show CLI Change-Id: I75af3fa7afc0f31b1e911b4c65ced77d826e88cf Closes-Bug: #1453645 --- congressclient/tests/v1/test_datasource.py | 27 +++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/congressclient/tests/v1/test_datasource.py b/congressclient/tests/v1/test_datasource.py index b57e7fd..18c7c4d 100644 --- a/congressclient/tests/v1/test_datasource.py +++ b/congressclient/tests/v1/test_datasource.py @@ -82,7 +82,6 @@ class TestListDatasourceStatus(common.TestCongressBase): ] response = {'last_updated': "now", 'last_error': "None"} - lister = mock.Mock(return_value=response) self.app.client_manager.congressclient.list_datasource_status = lister self.app.client_manager.congressclient.list_datasources = mock.Mock() @@ -203,6 +202,32 @@ class TestListDatasourceRows(common.TestCongressBase): self.assertEqual(['ID', 'name'], result[0]) +class TestShowDatasourceTable(common.TestCongressBase): + def test_show_datasource_table(self): + datasource_name = 'neutron' + table_id = 'ports' + arglist = [ + datasource_name, table_id + ] + verifylist = [ + ('datasource_name', datasource_name), + ('table_id', table_id) + ] + response = { + 'id': 'ports', + } + lister = mock.Mock(return_value=response) + client = self.app.client_manager.congressclient + client.show_datasource_table = lister + cmd = datasource.ShowDatasourceTable(self.app, self.namespace) + expected_ret = [('id',), ('ports',)] + + parsed_args = self.check_parser(cmd, arglist, verifylist) + result = list(cmd.take_action(parsed_args)) + + self.assertEqual(expected_ret, result) + + class TestCreateDatasource(common.TestCongressBase): def test_create_datasource(self):