Skip to content

Commit 3c67e8d

Browse files
author
Tang Chen
committed
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
1 parent b9de23d commit 3c67e8d

4 files changed

Lines changed: 27 additions & 9 deletions

File tree

openstackclient/tests/compute/v2/test_flavor.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,9 @@ def test_flavor_list_no_options(self):
126126

127127
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
128128

129-
# DisplayCommandBase.take_action() returns two tuples
129+
# In base command class Lister in cliff, abstractmethod take_action()
130+
# returns a tuple containing the column names and an iterable
131+
# containing the data to be listed.
130132
columns, data = self.cmd.take_action(parsed_args)
131133

132134
# Set expected values
@@ -153,7 +155,9 @@ def test_flavor_list_all_flavors(self):
153155

154156
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
155157

156-
# DisplayCommandBase.take_action() returns two tuples
158+
# In base command class Lister in cliff, abstractmethod take_action()
159+
# returns a tuple containing the column names and an iterable
160+
# containing the data to be listed.
157161
columns, data = self.cmd.take_action(parsed_args)
158162

159163
# Set expected values
@@ -180,7 +184,9 @@ def test_flavor_list_private_flavors(self):
180184

181185
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
182186

183-
# DisplayCommandBase.take_action() returns two tuples
187+
# In base command class Lister in cliff, abstractmethod take_action()
188+
# returns a tuple containing the column names and an iterable
189+
# containing the data to be listed.
184190
columns, data = self.cmd.take_action(parsed_args)
185191

186192
# Set expected values
@@ -207,7 +213,9 @@ def test_flavor_list_public_flavors(self):
207213

208214
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
209215

210-
# DisplayCommandBase.take_action() returns two tuples
216+
# In base command class Lister in cliff, abstractmethod take_action()
217+
# returns a tuple containing the column names and an iterable
218+
# containing the data to be listed.
211219
columns, data = self.cmd.take_action(parsed_args)
212220

213221
# Set expected values
@@ -234,7 +242,9 @@ def test_flavor_list_long(self):
234242

235243
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
236244

237-
# DisplayCommandBase.take_action() returns two tuples
245+
# In base command class Lister in cliff, abstractmethod take_action()
246+
# returns a tuple containing the column names and an iterable
247+
# containing the data to be listed.
238248
columns, data = self.cmd.take_action(parsed_args)
239249

240250
# Set expected values

openstackclient/tests/compute/v2/test_security_group.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,9 @@ def test_security_group_list_no_options(self):
158158

159159
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
160160

161-
# DisplayCommandBase.take_action() returns two tuples
161+
# In base command class Lister in cliff, abstractmethod take_action()
162+
# returns a tuple containing the column names and an iterable
163+
# containing the data to be listed.
162164
columns, data = self.cmd.take_action(parsed_args)
163165

164166
# Set expected values

openstackclient/tests/compute/v2/test_security_group_rule.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,9 @@ def test_security_group_rule_list(self):
404404

405405
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
406406

407-
# DisplayCommandBase.take_action() returns two tuples
407+
# In base command class Lister in cliff, abstractmethod take_action()
408+
# returns a tuple containing the column names and an iterable
409+
# containing the data to be listed.
408410
columns, data = self.cmd.take_action(parsed_args)
409411

410412
collist = (
@@ -440,7 +442,9 @@ def test_security_group_rule_list_no_group(self):
440442

441443
parsed_args = self.check_parser(self.cmd, [], [])
442444

443-
# DisplayCommandBase.take_action() returns two tuples
445+
# In base command class Lister in cliff, abstractmethod take_action()
446+
# returns a tuple containing the column names and an iterable
447+
# containing the data to be listed.
444448
columns, data = self.cmd.take_action(parsed_args)
445449

446450
collist = (

openstackclient/tests/compute/v2/test_service.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ def test_service_list(self):
8181
]
8282
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
8383

84-
# DisplayCommandBase.take_action() returns two tuples
84+
# In base command class Lister in cliff, abstractmethod take_action()
85+
# returns a tuple containing the column names and an iterable
86+
# containing the data to be listed.
8587
self.cmd.take_action(parsed_args)
8688

8789
self.service_mock.list.assert_called_with(

0 commit comments

Comments
 (0)