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
This commit is contained in:
Tang Chen 2016-02-10 19:15:37 +08:00
parent e1feed5221
commit 1225ad5f7e
6 changed files with 0 additions and 27 deletions

View File

@ -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(

View File

@ -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)

View File

@ -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(

View File

@ -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

View File

@ -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

View File

@ -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