diff options
| author | Tang Chen <chen.tang@easystack.cn> | 2016-02-10 20:51:58 +0800 |
|---|---|---|
| committer | Tang Chen <chen.tang@easystack.cn> | 2016-02-10 22:44:29 +0800 |
| commit | d0c0cefb84b4d7abff23e7e313acd9725df1be9b (patch) | |
| tree | a6bf2d6e597ecda30701a41d92e8bd5a6419870e /openstackclient/tests/identity/v2_0 | |
| parent | 1225ad5f7efc91fda27b7c6a1c84f1c5cadc54a6 (diff) | |
| download | python-openstackclient-d0c0cefb84b4d7abff23e7e313acd9725df1be9b.tar.gz | |
Identity: Fix DisplayCommandBase comments for cliff Lister subclass tests
As bug #1477199 describes, the wrong comment below is all over the
unit test code of OSC.
# DisplayCommandBase.take_action() returns two tuples
There is no such class named DisplayCommandBase in OSC. It is in cliff.
All OSC command classes inherit from the base classes in cliff,
class Command, class Lister and class ShowOne. It is like this:
Object
|--> Command
|--> DisplayCommandBase
|--> Lister
|--> ShowOne
take_action() is an abstract method of class Command, and generally is
overwritten by subclasses.
* Command.take_action() returns nothing.
* Lister.take_action() returns a tuple which contains a tuple of columns
and a generator used to generate the data.
* ShowOne.take_action() returns an iterator which contains a tuple of
columns and a tuple of data.
So, this problem should be fixed in 3 steps:
1. Remove all DisplayCommandBase comments for tests of classes inheriting
from class Command in cliff as it returns nothing.
2. Fix all DisplayCommandBase comments for tests of classes inheriting
from class Lister in cliff. Lister.take_action() returns a tuple and
a generator.
3. Fix all DisplayCommandBase comments for tests of classes inheriting
from class ShowOne in cliff. ShowOne.take_action() returns two tuples.
This patch finishes step 2 in all identity tests.
Change-Id: I2929ee688b1d7afc52c6ab325982bdc24c60a995
Partial-bug: #1477199
Diffstat (limited to 'openstackclient/tests/identity/v2_0')
6 files changed, 42 insertions, 14 deletions
diff --git a/openstackclient/tests/identity/v2_0/test_catalog.py b/openstackclient/tests/identity/v2_0/test_catalog.py index ff1d993e..adbf8c30 100644 --- a/openstackclient/tests/identity/v2_0/test_catalog.py +++ b/openstackclient/tests/identity/v2_0/test_catalog.py @@ -72,7 +72,9 @@ class TestCatalogList(TestCatalog): verifylist = [] parsed_args = self.check_parser(self.cmd, arglist, verifylist) - # DisplayCommandBase.take_action() returns two tuples + # In base command class Lister in cliff, abstract method take_action() + # returns a tuple containing the column names and an iterable + # containing the data to be listed. columns, data = self.cmd.take_action(parsed_args) self.sc_mock.service_catalog.get_data.assert_called_with() @@ -114,7 +116,9 @@ class TestCatalogList(TestCatalog): verifylist = [] parsed_args = self.check_parser(self.cmd, arglist, verifylist) - # DisplayCommandBase.take_action() returns two tuples + # In base command class Lister in cliff, abstract method take_action() + # returns a tuple containing the column names and an iterable + # containing the data to be listed. columns, data = self.cmd.take_action(parsed_args) self.sc_mock.service_catalog.get_data.assert_called_with() diff --git a/openstackclient/tests/identity/v2_0/test_endpoint.py b/openstackclient/tests/identity/v2_0/test_endpoint.py index 11696f46..9331b256 100644 --- a/openstackclient/tests/identity/v2_0/test_endpoint.py +++ b/openstackclient/tests/identity/v2_0/test_endpoint.py @@ -164,7 +164,9 @@ class TestEndpointList(TestEndpoint): verifylist = [] parsed_args = self.check_parser(self.cmd, arglist, verifylist) - # DisplayCommandBase.take_action() returns two tuples + # In base command class Lister in cliff, abstract method take_action() + # returns a tuple containing the column names and an iterable + # containing the data to be listed. columns, data = self.cmd.take_action(parsed_args) self.endpoints_mock.list.assert_called_with() @@ -188,7 +190,9 @@ class TestEndpointList(TestEndpoint): ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) - # DisplayCommandBase.take_action() returns two tuples + # In base command class Lister in cliff, abstract method take_action() + # returns a tuple containing the column names and an iterable + # containing the data to be listed. columns, data = self.cmd.take_action(parsed_args) self.endpoints_mock.list.assert_called_with() diff --git a/openstackclient/tests/identity/v2_0/test_project.py b/openstackclient/tests/identity/v2_0/test_project.py index 69b29268..ad4ab265 100644 --- a/openstackclient/tests/identity/v2_0/test_project.py +++ b/openstackclient/tests/identity/v2_0/test_project.py @@ -322,7 +322,9 @@ class TestProjectList(TestProject): verifylist = [] parsed_args = self.check_parser(self.cmd, arglist, verifylist) - # DisplayCommandBase.take_action() returns two tuples + # In base command class Lister in cliff, abstract method take_action() + # returns a tuple containing the column names and an iterable + # containing the data to be listed. columns, data = self.cmd.take_action(parsed_args) self.projects_mock.list.assert_called_with() @@ -343,7 +345,9 @@ class TestProjectList(TestProject): ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) - # DisplayCommandBase.take_action() returns two tuples + # In base command class Lister in cliff, abstract method take_action() + # returns a tuple containing the column names and an iterable + # containing the data to be listed. columns, data = self.cmd.take_action(parsed_args) self.projects_mock.list.assert_called_with() diff --git a/openstackclient/tests/identity/v2_0/test_role.py b/openstackclient/tests/identity/v2_0/test_role.py index b660c614..f884720f 100644 --- a/openstackclient/tests/identity/v2_0/test_role.py +++ b/openstackclient/tests/identity/v2_0/test_role.py @@ -260,7 +260,9 @@ class TestRoleList(TestRole): verifylist = [] parsed_args = self.check_parser(self.cmd, arglist, verifylist) - # DisplayCommandBase.take_action() returns two tuples + # In base command class Lister in cliff, abstract method take_action() + # returns a tuple containing the column names and an iterable + # containing the data to be listed. columns, data = self.cmd.take_action(parsed_args) self.roles_mock.list.assert_called_with() @@ -330,7 +332,9 @@ class TestUserRoleList(TestRole): verifylist = [] parsed_args = self.check_parser(self.cmd, arglist, verifylist) - # DisplayCommandBase.take_action() returns two tuples + # In base command class Lister in cliff, abstract method take_action() + # returns a tuple containing the column names and an iterable + # containing the data to be listed. columns, data = self.cmd.take_action(parsed_args) self.roles_mock.roles_for_user.assert_called_with( @@ -387,7 +391,9 @@ class TestUserRoleList(TestRole): ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) - # DisplayCommandBase.take_action() returns two tuples + # In base command class Lister in cliff, abstract method take_action() + # returns a tuple containing the column names and an iterable + # containing the data to be listed. columns, data = self.cmd.take_action(parsed_args) self.roles_mock.roles_for_user.assert_called_with( diff --git a/openstackclient/tests/identity/v2_0/test_service.py b/openstackclient/tests/identity/v2_0/test_service.py index 9c0cf8cd..27a592d5 100644 --- a/openstackclient/tests/identity/v2_0/test_service.py +++ b/openstackclient/tests/identity/v2_0/test_service.py @@ -214,7 +214,9 @@ class TestServiceList(TestService): verifylist = [] parsed_args = self.check_parser(self.cmd, arglist, verifylist) - # DisplayCommandBase.take_action() returns two tuples + # In base command class Lister in cliff, abstract method take_action() + # returns a tuple containing the column names and an iterable + # containing the data to be listed. columns, data = self.cmd.take_action(parsed_args) self.services_mock.list.assert_called_with() @@ -237,7 +239,9 @@ class TestServiceList(TestService): ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) - # DisplayCommandBase.take_action() returns two tuples + # In base command class Lister in cliff, abstract method take_action() + # returns a tuple containing the column names and an iterable + # containing the data to be listed. columns, data = self.cmd.take_action(parsed_args) self.services_mock.list.assert_called_with() diff --git a/openstackclient/tests/identity/v2_0/test_user.py b/openstackclient/tests/identity/v2_0/test_user.py index 0c4370f2..62d78c16 100644 --- a/openstackclient/tests/identity/v2_0/test_user.py +++ b/openstackclient/tests/identity/v2_0/test_user.py @@ -448,7 +448,9 @@ class TestUserList(TestUser): verifylist = [] parsed_args = self.check_parser(self.cmd, arglist, verifylist) - # DisplayCommandBase.take_action() returns two tuples + # In base command class Lister in cliff, abstract method take_action() + # returns a tuple containing the column names and an iterable + # containing the data to be listed. columns, data = self.cmd.take_action(parsed_args) self.users_mock.list.assert_called_with(tenant_id=None) @@ -466,7 +468,9 @@ class TestUserList(TestUser): parsed_args = self.check_parser(self.cmd, arglist, verifylist) project_id = identity_fakes.PROJECT_2['id'] - # DisplayCommandBase.take_action() returns two tuples + # In base command class Lister in cliff, abstract method take_action() + # returns a tuple containing the column names and an iterable + # containing the data to be listed. columns, data = self.cmd.take_action(parsed_args) self.users_mock.list.assert_called_with(tenant_id=project_id) @@ -483,7 +487,9 @@ class TestUserList(TestUser): ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) - # DisplayCommandBase.take_action() returns two tuples + # In base command class Lister in cliff, abstract method take_action() + # returns a tuple containing the column names and an iterable + # containing the data to be listed. columns, data = self.cmd.take_action(parsed_args) self.users_mock.list.assert_called_with(tenant_id=None) |
