summaryrefslogtreecommitdiff
path: root/openstackclient/tests/object
diff options
context:
space:
mode:
authorTang Chen <chen.tang@easystack.cn>2016-02-09 17:30:39 +0800
committerTang Chen <chen.tang@easystack.cn>2016-02-09 20:28:18 +0800
commite69b88ef525445325843c129e1a113a92ed98e3a (patch)
treefa2c06483016a4ab1c532251e964d20c7acc51d2 /openstackclient/tests/object
parent43f80505cbaa0945380e366a8cada71b55296463 (diff)
downloadpython-openstackclient-e69b88ef525445325843c129e1a113a92ed98e3a.tar.gz
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 but identity tests. There are too many such comments in identity tests. So fix them all in another patch. Change-Id: I00f38d12f55abe20fa708f6349073da658622f8d Partial-bug: #1477199
Diffstat (limited to 'openstackclient/tests/object')
-rw-r--r--openstackclient/tests/object/v1/test_container.py24
-rw-r--r--openstackclient/tests/object/v1/test_object.py32
-rw-r--r--openstackclient/tests/object/v1/test_object_all.py4
3 files changed, 45 insertions, 15 deletions
diff --git a/openstackclient/tests/object/v1/test_container.py b/openstackclient/tests/object/v1/test_container.py
index d34d73e2..62dc4f73 100644
--- a/openstackclient/tests/object/v1/test_container.py
+++ b/openstackclient/tests/object/v1/test_container.py
@@ -156,7 +156,9 @@ class TestContainerList(TestContainer):
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)
# Set expected values
@@ -188,7 +190,9 @@ class TestContainerList(TestContainer):
]
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)
# Set expected values
@@ -222,7 +226,9 @@ class TestContainerList(TestContainer):
]
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)
# Set expected values
@@ -255,7 +261,9 @@ class TestContainerList(TestContainer):
]
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)
# Set expected values
@@ -287,7 +295,9 @@ class TestContainerList(TestContainer):
]
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)
# Set expected values
@@ -328,7 +338,9 @@ class TestContainerList(TestContainer):
]
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)
# Set expected values
diff --git a/openstackclient/tests/object/v1/test_object.py b/openstackclient/tests/object/v1/test_object.py
index f0d62f6e..431ab472 100644
--- a/openstackclient/tests/object/v1/test_object.py
+++ b/openstackclient/tests/object/v1/test_object.py
@@ -67,7 +67,9 @@ class TestObjectList(TestObject):
]
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)
o_mock.assert_called_with(
@@ -96,7 +98,9 @@ class TestObjectList(TestObject):
]
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)
# Set expected values
@@ -126,7 +130,9 @@ class TestObjectList(TestObject):
]
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)
# Set expected values
@@ -156,7 +162,9 @@ class TestObjectList(TestObject):
]
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)
# Set expected values
@@ -186,7 +194,9 @@ class TestObjectList(TestObject):
]
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)
# Set expected values
@@ -216,7 +226,9 @@ class TestObjectList(TestObject):
]
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)
# Set expected values
@@ -247,7 +259,9 @@ class TestObjectList(TestObject):
]
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)
# Set expected values
@@ -294,7 +308,9 @@ class TestObjectList(TestObject):
]
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)
# Set expected values
diff --git a/openstackclient/tests/object/v1/test_object_all.py b/openstackclient/tests/object/v1/test_object_all.py
index a90e5b65..f36d2ea7 100644
--- a/openstackclient/tests/object/v1/test_object_all.py
+++ b/openstackclient/tests/object/v1/test_object_all.py
@@ -102,7 +102,9 @@ class TestObjectList(TestObjectAll):
]
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.assertEqual(self.columns, columns)