Compute: Fix DisplayCommandBase comments for cliff ShowOne 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 3 in compute tests.

Change-Id: I4df224ec82b5d82a3d6d3f366c0f68a7ea0d87cd
Partial-bug: #1477199
This commit is contained in:
Tang Chen 2016-02-06 10:47:56 +08:00
parent 3c67e8dd6e
commit 23faa33b1b
3 changed files with 36 additions and 12 deletions

View File

@ -90,7 +90,9 @@ class TestSecurityGroupCreate(TestSecurityGroup):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
# DisplayCommandBase.take_action() returns two tuples
# In base command class ShowOne in cliff, abstractmethod take_action()
# returns a two-part tuple with a tuple of column names and a tuple of
# data to be shown.
columns, data = self.cmd.take_action(parsed_args)
# SecurityGroupManager.create(name, description)
@ -113,7 +115,9 @@ class TestSecurityGroupCreate(TestSecurityGroup):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
# DisplayCommandBase.take_action() returns two tuples
# In base command class ShowOne in cliff, abstractmethod take_action()
# returns a two-part tuple with a tuple of column names and a tuple of
# data to be shown.
columns, data = self.cmd.take_action(parsed_args)
# SecurityGroupManager.create(name, description)

View File

@ -152,7 +152,9 @@ class TestSecurityGroupRuleCreate(TestSecurityGroupRule):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
# DisplayCommandBase.take_action() returns two tuples
# In base command class ShowOne in cliff, abstractmethod take_action()
# returns a two-part tuple with a tuple of column names and a tuple of
# data to be shown.
columns, data = self.cmd.take_action(parsed_args)
# SecurityGroupManager.create(name, description)
@ -196,7 +198,9 @@ class TestSecurityGroupRuleCreate(TestSecurityGroupRule):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
# DisplayCommandBase.take_action() returns two tuples
# In base command class ShowOne in cliff, abstractmethod take_action()
# returns a two-part tuple with a tuple of column names and a tuple of
# data to be shown.
columns, data = self.cmd.take_action(parsed_args)
# SecurityGroupManager.create(name, description)
@ -244,7 +248,9 @@ class TestSecurityGroupRuleCreate(TestSecurityGroupRule):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
# DisplayCommandBase.take_action() returns two tuples
# In base command class ShowOne in cliff, abstractmethod take_action()
# returns a two-part tuple with a tuple of column names and a tuple of
# data to be shown.
columns, data = self.cmd.take_action(parsed_args)
# SecurityGroupManager.create(name, description)
@ -287,7 +293,9 @@ class TestSecurityGroupRuleCreate(TestSecurityGroupRule):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
# DisplayCommandBase.take_action() returns two tuples
# In base command class ShowOne in cliff, abstractmethod take_action()
# returns a two-part tuple with a tuple of column names and a tuple of
# data to be shown.
columns, data = self.cmd.take_action(parsed_args)
# SecurityGroupManager.create(name, description)
@ -333,7 +341,9 @@ class TestSecurityGroupRuleCreate(TestSecurityGroupRule):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
# DisplayCommandBase.take_action() returns two tuples
# In base command class ShowOne in cliff, abstractmethod take_action()
# returns a two-part tuple with a tuple of column names and a tuple of
# data to be shown.
columns, data = self.cmd.take_action(parsed_args)
# SecurityGroupManager.create(name, description)

View File

@ -163,7 +163,9 @@ class TestServerCreate(TestServer):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
# DisplayCommandBase.take_action() returns two tuples
# In base command class ShowOne in cliff, abstractmethod take_action()
# returns a two-part tuple with a tuple of column names and a tuple of
# data to be shown.
columns, data = self.cmd.take_action(parsed_args)
# Set expected values
@ -241,7 +243,9 @@ class TestServerCreate(TestServer):
self.app.client_manager.network.find_network = find_network
self.app.client_manager.network.find_port = find_port
# DisplayCommandBase.take_action() returns two tuples
# In base command class ShowOne in cliff, abstractmethod take_action()
# returns a two-part tuple with a tuple of column names and a tuple of
# data to be shown.
columns, data = self.cmd.take_action(parsed_args)
# Set expected values
@ -299,7 +303,9 @@ class TestServerCreate(TestServer):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
# DisplayCommandBase.take_action() returns two tuples
# In base command class ShowOne in cliff, abstractmethod take_action()
# returns a two-part tuple with a tuple of column names and a tuple of
# data to be shown.
columns, data = self.cmd.take_action(parsed_args)
# Ensure the userdata file is opened
@ -551,7 +557,9 @@ class TestServerImageCreate(TestServer):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
# DisplayCommandBase.take_action() returns two tuples
# In base command class ShowOne in cliff, abstractmethod take_action()
# returns a two-part tuple with a tuple of column names and a tuple of
# data to be shown.
columns, data = self.cmd.take_action(parsed_args)
# ServerManager.create_image(server, image_name, metadata=)
@ -574,7 +582,9 @@ class TestServerImageCreate(TestServer):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
# DisplayCommandBase.take_action() returns two tuples
# In base command class ShowOne in cliff, abstractmethod take_action()
# returns a two-part tuple with a tuple of column names and a tuple of
# data to be shown.
columns, data = self.cmd.take_action(parsed_args)
# ServerManager.create_image(server, image_name, metadata=)