From 1225ad5f7efc91fda27b7c6a1c84f1c5cadc54a6 Mon Sep 17 00:00:00 2001 From: Tang Chen Date: Wed, 10 Feb 2016 19:15:37 +0800 Subject: [PATCH] Identity: Fix DisplayCommandBase comments for cliff Command 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 1 in all identity tests. Change-Id: Id7180d10c050c6286b2c05cd990e2e275fbc3d38 Partial-bug: #1477199 --- openstackclient/tests/identity/v2_0/test_endpoint.py | 1 - openstackclient/tests/identity/v2_0/test_role.py | 2 -- openstackclient/tests/identity/v2_0/test_service.py | 1 - openstackclient/tests/identity/v2_0/test_user.py | 8 -------- openstackclient/tests/identity/v3/test_role.py | 6 ------ openstackclient/tests/identity/v3/test_user.py | 9 --------- 6 files changed, 27 deletions(-) diff --git a/openstackclient/tests/identity/v2_0/test_endpoint.py b/openstackclient/tests/identity/v2_0/test_endpoint.py index 354b1e4071..11696f4660 100644 --- a/openstackclient/tests/identity/v2_0/test_endpoint.py +++ b/openstackclient/tests/identity/v2_0/test_endpoint.py @@ -130,7 +130,6 @@ class TestEndpointDelete(TestEndpoint): ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) - # DisplayCommandBase.take_action() returns two tuples self.cmd.take_action(parsed_args) self.endpoints_mock.delete.assert_called_with( diff --git a/openstackclient/tests/identity/v2_0/test_role.py b/openstackclient/tests/identity/v2_0/test_role.py index c2bacc5207..b660c61491 100644 --- a/openstackclient/tests/identity/v2_0/test_role.py +++ b/openstackclient/tests/identity/v2_0/test_role.py @@ -232,7 +232,6 @@ class TestRoleDelete(TestRole): ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) - # DisplayCommandBase.take_action() returns two tuples self.cmd.take_action(parsed_args) self.roles_mock.delete.assert_called_with( @@ -446,7 +445,6 @@ class TestRoleRemove(TestRole): ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) - # DisplayCommandBase.take_action() returns two tuples self.cmd.take_action(parsed_args) # RoleManager.remove_user_role(user, role, tenant=None) diff --git a/openstackclient/tests/identity/v2_0/test_service.py b/openstackclient/tests/identity/v2_0/test_service.py index b97786b420..9c0cf8cded 100644 --- a/openstackclient/tests/identity/v2_0/test_service.py +++ b/openstackclient/tests/identity/v2_0/test_service.py @@ -186,7 +186,6 @@ class TestServiceDelete(TestService): ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) - # DisplayCommandBase.take_action() returns two tuples self.cmd.take_action(parsed_args) self.services_mock.delete.assert_called_with( diff --git a/openstackclient/tests/identity/v2_0/test_user.py b/openstackclient/tests/identity/v2_0/test_user.py index a25def8786..0c4370f25c 100644 --- a/openstackclient/tests/identity/v2_0/test_user.py +++ b/openstackclient/tests/identity/v2_0/test_user.py @@ -396,7 +396,6 @@ class TestUserDelete(TestUser): ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) - # DisplayCommandBase.take_action() returns two tuples self.cmd.take_action(parsed_args) self.users_mock.delete.assert_called_with( @@ -554,7 +553,6 @@ class TestUserSet(TestUser): ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) - # DisplayCommandBase.take_action() returns two tuples self.cmd.take_action(parsed_args) # Set expected values @@ -585,7 +583,6 @@ class TestUserSet(TestUser): ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) - # DisplayCommandBase.take_action() returns two tuples self.cmd.take_action(parsed_args) # UserManager.update_password(user, password) @@ -611,7 +608,6 @@ class TestUserSet(TestUser): ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) - # DisplayCommandBase.take_action() returns two tuples mocker = mock.Mock() mocker.return_value = 'abc123' with mock.patch("openstackclient.common.utils.get_password", mocker): @@ -639,7 +635,6 @@ class TestUserSet(TestUser): ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) - # DisplayCommandBase.take_action() returns two tuples self.cmd.take_action(parsed_args) # Set expected values @@ -669,7 +664,6 @@ class TestUserSet(TestUser): ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) - # DisplayCommandBase.take_action() returns two tuples self.cmd.take_action(parsed_args) # UserManager.update_tenant(user, tenant) @@ -694,7 +688,6 @@ class TestUserSet(TestUser): ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) - # DisplayCommandBase.take_action() returns two tuples self.cmd.take_action(parsed_args) # Set expected values @@ -723,7 +716,6 @@ class TestUserSet(TestUser): ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) - # DisplayCommandBase.take_action() returns two tuples self.cmd.take_action(parsed_args) # Set expected values diff --git a/openstackclient/tests/identity/v3/test_role.py b/openstackclient/tests/identity/v3/test_role.py index 1910c8742b..227b06439e 100644 --- a/openstackclient/tests/identity/v3/test_role.py +++ b/openstackclient/tests/identity/v3/test_role.py @@ -304,7 +304,6 @@ class TestRoleDelete(TestRole): ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) - # DisplayCommandBase.take_action() returns two tuples self.cmd.take_action(parsed_args) self.roles_mock.delete.assert_called_with( @@ -625,7 +624,6 @@ class TestRoleRemove(TestRole): ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) - # DisplayCommandBase.take_action() returns two tuples self.cmd.take_action(parsed_args) # Set expected values @@ -658,7 +656,6 @@ class TestRoleRemove(TestRole): ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) - # DisplayCommandBase.take_action() returns two tuples self.cmd.take_action(parsed_args) # Set expected values @@ -692,7 +689,6 @@ class TestRoleRemove(TestRole): ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) - # DisplayCommandBase.take_action() returns two tuples self.cmd.take_action(parsed_args) # Set expected values @@ -725,7 +721,6 @@ class TestRoleRemove(TestRole): ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) - # DisplayCommandBase.take_action() returns two tuples self.cmd.take_action(parsed_args) # Set expected values @@ -767,7 +762,6 @@ class TestRoleSet(TestRole): ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) - # DisplayCommandBase.take_action() returns two tuples self.cmd.take_action(parsed_args) # Set expected values diff --git a/openstackclient/tests/identity/v3/test_user.py b/openstackclient/tests/identity/v3/test_user.py index 1871ed189b..641def0e8a 100644 --- a/openstackclient/tests/identity/v3/test_user.py +++ b/openstackclient/tests/identity/v3/test_user.py @@ -481,7 +481,6 @@ class TestUserDelete(TestUser): ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) - # DisplayCommandBase.take_action() returns two tuples self.cmd.take_action(parsed_args) self.users_mock.delete.assert_called_with( @@ -746,7 +745,6 @@ class TestUserSet(TestUser): ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) - # DisplayCommandBase.take_action() returns two tuples self.cmd.take_action(parsed_args) # Set expected values @@ -778,7 +776,6 @@ class TestUserSet(TestUser): ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) - # DisplayCommandBase.take_action() returns two tuples self.cmd.take_action(parsed_args) # Set expected values @@ -810,7 +807,6 @@ class TestUserSet(TestUser): ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) - # DisplayCommandBase.take_action() returns two tuples mocker = mock.Mock() mocker.return_value = 'abc123' with mock.patch("openstackclient.common.utils.get_password", mocker): @@ -844,7 +840,6 @@ class TestUserSet(TestUser): ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) - # DisplayCommandBase.take_action() returns two tuples self.cmd.take_action(parsed_args) # Set expected values @@ -875,7 +870,6 @@ class TestUserSet(TestUser): ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) - # DisplayCommandBase.take_action() returns two tuples self.cmd.take_action(parsed_args) # Set expected values @@ -908,7 +902,6 @@ class TestUserSet(TestUser): ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) - # DisplayCommandBase.take_action() returns two tuples self.cmd.take_action(parsed_args) # Set expected values @@ -939,7 +932,6 @@ class TestUserSet(TestUser): ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) - # DisplayCommandBase.take_action() returns two tuples self.cmd.take_action(parsed_args) # Set expected values @@ -969,7 +961,6 @@ class TestUserSet(TestUser): ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) - # DisplayCommandBase.take_action() returns two tuples self.cmd.take_action(parsed_args) # Set expected values