From e69b88ef525445325843c129e1a113a92ed98e3a Mon Sep 17 00:00:00 2001 From: Tang Chen Date: Tue, 9 Feb 2016 17:30:39 +0800 Subject: 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 --- .../tests/common/test_availability_zone.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'openstackclient/tests/common/test_availability_zone.py') diff --git a/openstackclient/tests/common/test_availability_zone.py b/openstackclient/tests/common/test_availability_zone.py index e44455c7..feecaf55 100644 --- a/openstackclient/tests/common/test_availability_zone.py +++ b/openstackclient/tests/common/test_availability_zone.py @@ -144,7 +144,9 @@ class TestAvailabilityZoneList(TestAvailabilityZone): 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) self.compute_azs_mock.list.assert_called_with() @@ -170,7 +172,9 @@ class TestAvailabilityZoneList(TestAvailabilityZone): ] 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.compute_azs_mock.list.assert_called_with() @@ -199,7 +203,9 @@ class TestAvailabilityZoneList(TestAvailabilityZone): ] 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.compute_azs_mock.list.assert_called_with() @@ -221,7 +227,9 @@ class TestAvailabilityZoneList(TestAvailabilityZone): ] 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.compute_azs_mock.list.assert_not_called() @@ -243,7 +251,9 @@ class TestAvailabilityZoneList(TestAvailabilityZone): ] 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.compute_azs_mock.list.assert_not_called() -- cgit v1.2.1