Skip to content

Commit 35833f7

Browse files
author
Tang Chen
committed
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 all but identity tests. There are too many such comments in identity tests. So fix them all in another patch. Change-Id: I1afe4852069d25d562a9448ec2bf2cff58955052 Partial-bug: #1477199
1 parent e69b88e commit 35833f7

8 files changed

Lines changed: 90 additions & 30 deletions

File tree

openstackclient/tests/image/v1/test_image.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ def test_image_reserve_no_options(self):
7373
]
7474
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
7575

76-
# DisplayCommandBase.take_action() returns two tuples
76+
# In base command class ShowOne in cliff, abstract method take_action()
77+
# returns a two-part tuple with a tuple of column names and a tuple of
78+
# data to be shown.
7779
columns, data = self.cmd.take_action(parsed_args)
7880

7981
# ImageManager.create(name=, **)
@@ -120,7 +122,9 @@ def test_image_reserve_options(self):
120122
]
121123
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
122124

123-
# DisplayCommandBase.take_action() returns two tuples
125+
# In base command class ShowOne in cliff, abstract method take_action()
126+
# returns a two-part tuple with a tuple of column names and a tuple of
127+
# data to be shown.
124128
columns, data = self.cmd.take_action(parsed_args)
125129

126130
# ImageManager.create(name=, **)
@@ -172,7 +176,9 @@ def test_image_create_file(self, mock_open):
172176
]
173177
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
174178

175-
# DisplayCommandBase.take_action() returns two tuples
179+
# In base command class ShowOne in cliff, abstract method take_action()
180+
# returns a two-part tuple with a tuple of column names and a tuple of
181+
# data to be shown.
176182
columns, data = self.cmd.take_action(parsed_args)
177183

178184
# Ensure input file is opened
@@ -676,7 +682,9 @@ def test_image_show(self):
676682
]
677683
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
678684

679-
# DisplayCommandBase.take_action() returns two tuples
685+
# In base command class ShowOne in cliff, abstract method take_action()
686+
# returns a two-part tuple with a tuple of column names and a tuple of
687+
# data to be shown.
680688
columns, data = self.cmd.take_action(parsed_args)
681689
self.images_mock.get.assert_called_with(
682690
image_fakes.image_id,

openstackclient/tests/image/v2/test_image.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,9 @@ def test_image_reserve_no_options(self):
9595
]
9696
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
9797

98-
# DisplayCommandBase.take_action() returns two tuples
98+
# In base command class ShowOne in cliff, abstract method take_action()
99+
# returns a two-part tuple with a tuple of column names and a tuple of
100+
# data to be shown.
99101
columns, data = self.cmd.take_action(parsed_args)
100102

101103
# ImageManager.create(name=, **)
@@ -156,7 +158,9 @@ def test_image_reserve_options(self, mock_open):
156158
]
157159
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
158160

159-
# DisplayCommandBase.take_action() returns two tuples
161+
# In base command class ShowOne in cliff, abstract method take_action()
162+
# returns a two-part tuple with a tuple of column names and a tuple of
163+
# data to be shown.
160164
columns, data = self.cmd.take_action(parsed_args)
161165

162166
# ImageManager.create(name=, **)
@@ -288,7 +292,9 @@ def test_image_create_file(self, mock_open):
288292
]
289293
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
290294

291-
# DisplayCommandBase.take_action() returns two tuples
295+
# In base command class ShowOne in cliff, abstract method take_action()
296+
# returns a two-part tuple with a tuple of column names and a tuple of
297+
# data to be shown.
292298
columns, data = self.cmd.take_action(parsed_args)
293299

294300
# ImageManager.create(name=, **)
@@ -382,7 +388,9 @@ def test_add_project_to_image_no_option(self):
382388
]
383389
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
384390

385-
# DisplayCommandBase.take_action() returns two tuples
391+
# In base command class ShowOne in cliff, abstract method take_action()
392+
# returns a two-part tuple with a tuple of column names and a tuple of
393+
# data to be shown.
386394
columns, data = self.cmd.take_action(parsed_args)
387395
self.image_members_mock.create.assert_called_with(
388396
image_fakes.image_id,
@@ -404,7 +412,9 @@ def test_add_project_to_image_with_option(self):
404412
]
405413
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
406414

407-
# DisplayCommandBase.take_action() returns two tuples
415+
# In base command class ShowOne in cliff, abstract method take_action()
416+
# returns a two-part tuple with a tuple of column names and a tuple of
417+
# data to be shown.
408418
columns, data = self.cmd.take_action(parsed_args)
409419
self.image_members_mock.create.assert_called_with(
410420
image_fakes.image_id,
@@ -1156,7 +1166,9 @@ def test_image_show(self):
11561166
]
11571167
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
11581168

1159-
# DisplayCommandBase.take_action() returns two tuples
1169+
# In base command class ShowOne in cliff, abstract method take_action()
1170+
# returns a two-part tuple with a tuple of column names and a tuple of
1171+
# data to be shown.
11601172
columns, data = self.cmd.take_action(parsed_args)
11611173
self.images_mock.get.assert_called_with(
11621174
image_fakes.image_id,

openstackclient/tests/object/v1/test_container.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,9 @@ def test_container_show(self, c_mock):
382382
]
383383
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
384384

385-
# DisplayCommandBase.take_action() returns two tuples
385+
# In base command class ShowOne in cliff, abstract method take_action()
386+
# returns a two-part tuple with a tuple of column names and a tuple of
387+
# data to be shown.
386388
columns, data = self.cmd.take_action(parsed_args)
387389

388390
# Set expected values

openstackclient/tests/object/v1/test_container_all.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ def test_object_create_container_single(self):
5757
)]
5858
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
5959

60-
# DisplayCommandBase.take_action() returns two tuples
60+
# In base command class ShowOne in cliff, abstract method take_action()
61+
# returns a two-part tuple with a tuple of column names and a tuple of
62+
# data to be shown.
6163
columns, data = self.cmd.take_action(parsed_args)
6264

6365
self.assertEqual(self.columns, columns)
@@ -91,7 +93,9 @@ def test_object_create_container_more(self):
9193
)]
9294
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
9395

94-
# DisplayCommandBase.take_action() returns two tuples
96+
# In base command class ShowOne in cliff, abstract method take_action()
97+
# returns a two-part tuple with a tuple of column names and a tuple of
98+
# data to be shown.
9599
columns, data = self.cmd.take_action(parsed_args)
96100

97101
self.assertEqual(self.columns, columns)
@@ -312,7 +316,9 @@ def test_object_show_container(self):
312316
)]
313317
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
314318

315-
# DisplayCommandBase.take_action() returns two tuples
319+
# In base command class ShowOne in cliff, abstract method take_action()
320+
# returns a two-part tuple with a tuple of column names and a tuple of
321+
# data to be shown.
316322
columns, data = self.cmd.take_action(parsed_args)
317323

318324
collist = (

openstackclient/tests/object/v1/test_object.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,9 @@ def test_object_show(self, c_mock):
354354
]
355355
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
356356

357-
# DisplayCommandBase.take_action() returns two tuples
357+
# In base command class ShowOne in cliff, abstract method take_action()
358+
# returns a two-part tuple with a tuple of column names and a tuple of
359+
# data to be shown.
358360
columns, data = self.cmd.take_action(parsed_args)
359361

360362
# Set expected values

openstackclient/tests/object/v1/test_object_all.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,9 @@ def test_object_show(self):
152152
]
153153
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
154154

155-
# DisplayCommandBase.take_action() returns two tuples
155+
# In base command class ShowOne in cliff, abstract method take_action()
156+
# returns a two-part tuple with a tuple of column names and a tuple of
157+
# data to be shown.
156158
columns, data = self.cmd.take_action(parsed_args)
157159

158160
collist = (

openstackclient/tests/volume/v1/test_volume.py

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,9 @@ def test_volume_create_min_options(self):
9595
]
9696
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
9797

98-
# DisplayCommandBase.take_action() returns two tuples
98+
# In base command class ShowOne in cliff, abstract method take_action()
99+
# returns a two-part tuple with a tuple of column names and a tuple of
100+
# data to be shown.
99101
columns, data = self.cmd.take_action(parsed_args)
100102

101103
# VolumeManager.create(size, snapshot_id=, source_volid=,
@@ -136,7 +138,9 @@ def test_volume_create_options(self):
136138
]
137139
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
138140

139-
# DisplayCommandBase.take_action() returns two tuples
141+
# In base command class ShowOne in cliff, abstract method take_action()
142+
# returns a two-part tuple with a tuple of column names and a tuple of
143+
# data to be shown.
140144
columns, data = self.cmd.take_action(parsed_args)
141145

142146
# VolumeManager.create(size, snapshot_id=, source_volid=,
@@ -189,7 +193,9 @@ def test_volume_create_user_project_id(self):
189193
]
190194
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
191195

192-
# DisplayCommandBase.take_action() returns two tuples
196+
# In base command class ShowOne in cliff, abstract method take_action()
197+
# returns a two-part tuple with a tuple of column names and a tuple of
198+
# data to be shown.
193199
columns, data = self.cmd.take_action(parsed_args)
194200

195201
# VolumeManager.create(size, snapshot_id=, source_volid=,
@@ -242,7 +248,9 @@ def test_volume_create_user_project_name(self):
242248
]
243249
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
244250

245-
# DisplayCommandBase.take_action() returns two tuples
251+
# In base command class ShowOne in cliff, abstract method take_action()
252+
# returns a two-part tuple with a tuple of column names and a tuple of
253+
# data to be shown.
246254
columns, data = self.cmd.take_action(parsed_args)
247255

248256
# VolumeManager.create(size, snapshot_id=, source_volid=,
@@ -281,7 +289,9 @@ def test_volume_create_properties(self):
281289
]
282290
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
283291

284-
# DisplayCommandBase.take_action() returns two tuples
292+
# In base command class ShowOne in cliff, abstract method take_action()
293+
# returns a two-part tuple with a tuple of column names and a tuple of
294+
# data to be shown.
285295
columns, data = self.cmd.take_action(parsed_args)
286296

287297
# VolumeManager.create(size, snapshot_id=, source_volid=,
@@ -325,7 +335,9 @@ def test_volume_create_image_id(self):
325335
]
326336
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
327337

328-
# DisplayCommandBase.take_action() returns two tuples
338+
# In base command class ShowOne in cliff, abstract method take_action()
339+
# returns a two-part tuple with a tuple of column names and a tuple of
340+
# data to be shown.
329341
columns, data = self.cmd.take_action(parsed_args)
330342

331343
# VolumeManager.create(size, snapshot_id=, source_volid=,
@@ -369,7 +381,9 @@ def test_volume_create_image_name(self):
369381
]
370382
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
371383

372-
# DisplayCommandBase.take_action() returns two tuples
384+
# In base command class ShowOne in cliff, abstract method take_action()
385+
# returns a two-part tuple with a tuple of column names and a tuple of
386+
# data to be shown.
373387
columns, data = self.cmd.take_action(parsed_args)
374388

375389
# VolumeManager.create(size, snapshot_id=, source_volid=,

openstackclient/tests/volume/v2/test_volume.py

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,9 @@ def test_volume_create_min_options(self):
9696
]
9797
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
9898

99-
# DisplayCommandBase.take_action() returns two tuples
99+
# In base command class ShowOne in cliff, abstract method take_action()
100+
# returns a two-part tuple with a tuple of column names and a tuple of
101+
# data to be shown.
100102
columns, data = self.cmd.take_action(parsed_args)
101103

102104
self.volumes_mock.create.assert_called_with(
@@ -133,7 +135,9 @@ def test_volume_create_options(self):
133135
]
134136
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
135137

136-
# DisplayCommandBase.take_action() returns two tuples
138+
# In base command class ShowOne in cliff, abstract method take_action()
139+
# returns a two-part tuple with a tuple of column names and a tuple of
140+
# data to be shown.
137141
columns, data = self.cmd.take_action(parsed_args)
138142

139143
self.volumes_mock.create.assert_called_with(
@@ -181,7 +185,9 @@ def test_volume_create_user_project_id(self):
181185
]
182186
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
183187

184-
# DisplayCommandBase.take_action() returns two tuples
188+
# In base command class ShowOne in cliff, abstract method take_action()
189+
# returns a two-part tuple with a tuple of column names and a tuple of
190+
# data to be shown.
185191
columns, data = self.cmd.take_action(parsed_args)
186192

187193
self.volumes_mock.create.assert_called_with(
@@ -229,7 +235,9 @@ def test_volume_create_user_project_name(self):
229235
]
230236
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
231237

232-
# DisplayCommandBase.take_action() returns two tuples
238+
# In base command class ShowOne in cliff, abstract method take_action()
239+
# returns a two-part tuple with a tuple of column names and a tuple of
240+
# data to be shown.
233241
columns, data = self.cmd.take_action(parsed_args)
234242

235243
self.volumes_mock.create.assert_called_with(
@@ -263,7 +271,9 @@ def test_volume_create_properties(self):
263271
]
264272
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
265273

266-
# DisplayCommandBase.take_action() returns two tuples
274+
# In base command class ShowOne in cliff, abstract method take_action()
275+
# returns a two-part tuple with a tuple of column names and a tuple of
276+
# data to be shown.
267277
columns, data = self.cmd.take_action(parsed_args)
268278

269279
self.volumes_mock.create.assert_called_with(
@@ -302,7 +312,9 @@ def test_volume_create_image_id(self):
302312
]
303313
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
304314

305-
# DisplayCommandBase.take_action() returns two tuples
315+
# In base command class ShowOne in cliff, abstract method take_action()
316+
# returns a two-part tuple with a tuple of column names and a tuple of
317+
# data to be shown.
306318
columns, data = self.cmd.take_action(parsed_args)
307319

308320
self.volumes_mock.create.assert_called_with(
@@ -341,7 +353,9 @@ def test_volume_create_image_name(self):
341353
]
342354
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
343355

344-
# DisplayCommandBase.take_action() returns two tuples
356+
# In base command class ShowOne in cliff, abstract method take_action()
357+
# returns a two-part tuple with a tuple of column names and a tuple of
358+
# data to be shown.
345359
columns, data = self.cmd.take_action(parsed_args)
346360

347361
self.volumes_mock.create.assert_called_with(

0 commit comments

Comments
 (0)