summaryrefslogtreecommitdiff
path: root/openstackclient/tests
diff options
context:
space:
mode:
authorTang Chen <chen.tang@easystack.cn>2016-02-06 10:30:34 +0800
committerTang Chen <chen.tang@easystack.cn>2016-02-06 10:30:34 +0800
commit3c67e8dd6ed20f9a3d6c1f8f000214cc7a8f384e (patch)
treea541293a42379a739de5ca87e25099ecddfdcef5 /openstackclient/tests
parentb9de23d906a0ba640c336006e1b373a079846995 (diff)
downloadpython-openstackclient-3c67e8dd6ed20f9a3d6c1f8f000214cc7a8f384e.tar.gz
Compute: 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 compute tests. Change-Id: Idc54ad21eaa1371ebd601327b8d962c7039f2de0 Partial-bug: #1477199
Diffstat (limited to 'openstackclient/tests')
-rw-r--r--openstackclient/tests/compute/v2/test_flavor.py20
-rw-r--r--openstackclient/tests/compute/v2/test_security_group.py4
-rw-r--r--openstackclient/tests/compute/v2/test_security_group_rule.py8
-rw-r--r--openstackclient/tests/compute/v2/test_service.py4
4 files changed, 27 insertions, 9 deletions
diff --git a/openstackclient/tests/compute/v2/test_flavor.py b/openstackclient/tests/compute/v2/test_flavor.py
index 3a59020c..9ae26962 100644
--- a/openstackclient/tests/compute/v2/test_flavor.py
+++ b/openstackclient/tests/compute/v2/test_flavor.py
@@ -126,7 +126,9 @@ class TestFlavorList(TestFlavor):
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # In base command class Lister in cliff, abstractmethod 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)
# Set expected values
@@ -153,7 +155,9 @@ class TestFlavorList(TestFlavor):
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # In base command class Lister in cliff, abstractmethod 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)
# Set expected values
@@ -180,7 +184,9 @@ class TestFlavorList(TestFlavor):
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # In base command class Lister in cliff, abstractmethod 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)
# Set expected values
@@ -207,7 +213,9 @@ class TestFlavorList(TestFlavor):
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # In base command class Lister in cliff, abstractmethod 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)
# Set expected values
@@ -234,7 +242,9 @@ class TestFlavorList(TestFlavor):
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # In base command class Lister in cliff, abstractmethod 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)
# Set expected values
diff --git a/openstackclient/tests/compute/v2/test_security_group.py b/openstackclient/tests/compute/v2/test_security_group.py
index 87cc4870..63ced735 100644
--- a/openstackclient/tests/compute/v2/test_security_group.py
+++ b/openstackclient/tests/compute/v2/test_security_group.py
@@ -158,7 +158,9 @@ class TestSecurityGroupList(TestSecurityGroup):
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # In base command class Lister in cliff, abstractmethod 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)
# Set expected values
diff --git a/openstackclient/tests/compute/v2/test_security_group_rule.py b/openstackclient/tests/compute/v2/test_security_group_rule.py
index a2f9b108..fc75bde9 100644
--- a/openstackclient/tests/compute/v2/test_security_group_rule.py
+++ b/openstackclient/tests/compute/v2/test_security_group_rule.py
@@ -404,7 +404,9 @@ class TestSecurityGroupRuleList(TestSecurityGroupRule):
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # In base command class Lister in cliff, abstractmethod 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)
collist = (
@@ -440,7 +442,9 @@ class TestSecurityGroupRuleList(TestSecurityGroupRule):
parsed_args = self.check_parser(self.cmd, [], [])
- # DisplayCommandBase.take_action() returns two tuples
+ # In base command class Lister in cliff, abstractmethod 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)
collist = (
diff --git a/openstackclient/tests/compute/v2/test_service.py b/openstackclient/tests/compute/v2/test_service.py
index c9c45c1f..71700aa8 100644
--- a/openstackclient/tests/compute/v2/test_service.py
+++ b/openstackclient/tests/compute/v2/test_service.py
@@ -81,7 +81,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, abstractmethod take_action()
+ # returns a tuple containing the column names and an iterable
+ # containing the data to be listed.
self.cmd.take_action(parsed_args)
self.service_mock.list.assert_called_with(