Skip to content

Commit d0c0cef

Browse files
author
Tang Chen
committed
Identity: 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 identity tests. Change-Id: I2929ee688b1d7afc52c6ab325982bdc24c60a995 Partial-bug: #1477199
1 parent 1225ad5 commit d0c0cef

21 files changed

Lines changed: 168 additions & 56 deletions

openstackclient/tests/identity/v2_0/test_catalog.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ def test_catalog_list(self):
7272
verifylist = []
7373
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
7474

75-
# DisplayCommandBase.take_action() returns two tuples
75+
# In base command class Lister in cliff, abstract method take_action()
76+
# returns a tuple containing the column names and an iterable
77+
# containing the data to be listed.
7678
columns, data = self.cmd.take_action(parsed_args)
7779
self.sc_mock.service_catalog.get_data.assert_called_with()
7880

@@ -114,7 +116,9 @@ def test_catalog_list_with_endpoint_url(self):
114116
verifylist = []
115117
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
116118

117-
# DisplayCommandBase.take_action() returns two tuples
119+
# In base command class Lister in cliff, abstract method take_action()
120+
# returns a tuple containing the column names and an iterable
121+
# containing the data to be listed.
118122
columns, data = self.cmd.take_action(parsed_args)
119123
self.sc_mock.service_catalog.get_data.assert_called_with()
120124

openstackclient/tests/identity/v2_0/test_endpoint.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,9 @@ def test_endpoint_list_no_options(self):
164164
verifylist = []
165165
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
166166

167-
# DisplayCommandBase.take_action() returns two tuples
167+
# In base command class Lister in cliff, abstract method take_action()
168+
# returns a tuple containing the column names and an iterable
169+
# containing the data to be listed.
168170
columns, data = self.cmd.take_action(parsed_args)
169171

170172
self.endpoints_mock.list.assert_called_with()
@@ -188,7 +190,9 @@ def test_endpoint_list_long(self):
188190
]
189191
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
190192

191-
# DisplayCommandBase.take_action() returns two tuples
193+
# In base command class Lister in cliff, abstract method take_action()
194+
# returns a tuple containing the column names and an iterable
195+
# containing the data to be listed.
192196
columns, data = self.cmd.take_action(parsed_args)
193197

194198
self.endpoints_mock.list.assert_called_with()

openstackclient/tests/identity/v2_0/test_project.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,9 @@ def test_project_list_no_options(self):
322322
verifylist = []
323323
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
324324

325-
# DisplayCommandBase.take_action() returns two tuples
325+
# In base command class Lister in cliff, abstract method take_action()
326+
# returns a tuple containing the column names and an iterable
327+
# containing the data to be listed.
326328
columns, data = self.cmd.take_action(parsed_args)
327329
self.projects_mock.list.assert_called_with()
328330

@@ -343,7 +345,9 @@ def test_project_list_long(self):
343345
]
344346
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
345347

346-
# DisplayCommandBase.take_action() returns two tuples
348+
# In base command class Lister in cliff, abstract method take_action()
349+
# returns a tuple containing the column names and an iterable
350+
# containing the data to be listed.
347351
columns, data = self.cmd.take_action(parsed_args)
348352
self.projects_mock.list.assert_called_with()
349353

openstackclient/tests/identity/v2_0/test_role.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,9 @@ def test_role_list_no_options(self):
260260
verifylist = []
261261
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
262262

263-
# DisplayCommandBase.take_action() returns two tuples
263+
# In base command class Lister in cliff, abstract method take_action()
264+
# returns a tuple containing the column names and an iterable
265+
# containing the data to be listed.
264266
columns, data = self.cmd.take_action(parsed_args)
265267

266268
self.roles_mock.list.assert_called_with()
@@ -330,7 +332,9 @@ def test_user_role_list_no_options_def_creds(self):
330332
verifylist = []
331333
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
332334

333-
# DisplayCommandBase.take_action() returns two tuples
335+
# In base command class Lister in cliff, abstract method take_action()
336+
# returns a tuple containing the column names and an iterable
337+
# containing the data to be listed.
334338
columns, data = self.cmd.take_action(parsed_args)
335339

336340
self.roles_mock.roles_for_user.assert_called_with(
@@ -387,7 +391,9 @@ def test_user_role_list_project_def_creds(self):
387391
]
388392
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
389393

390-
# DisplayCommandBase.take_action() returns two tuples
394+
# In base command class Lister in cliff, abstract method take_action()
395+
# returns a tuple containing the column names and an iterable
396+
# containing the data to be listed.
391397
columns, data = self.cmd.take_action(parsed_args)
392398

393399
self.roles_mock.roles_for_user.assert_called_with(

openstackclient/tests/identity/v2_0/test_service.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,9 @@ def test_service_list_no_options(self):
214214
verifylist = []
215215
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
216216

217-
# DisplayCommandBase.take_action() returns two tuples
217+
# In base command class Lister in cliff, abstract method take_action()
218+
# returns a tuple containing the column names and an iterable
219+
# containing the data to be listed.
218220
columns, data = self.cmd.take_action(parsed_args)
219221

220222
self.services_mock.list.assert_called_with()
@@ -237,7 +239,9 @@ def test_service_list_long(self):
237239
]
238240
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
239241

240-
# DisplayCommandBase.take_action() returns two tuples
242+
# In base command class Lister in cliff, abstract method take_action()
243+
# returns a tuple containing the column names and an iterable
244+
# containing the data to be listed.
241245
columns, data = self.cmd.take_action(parsed_args)
242246

243247
self.services_mock.list.assert_called_with()

openstackclient/tests/identity/v2_0/test_user.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,9 @@ def test_user_list_no_options(self):
448448
verifylist = []
449449
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
450450

451-
# DisplayCommandBase.take_action() returns two tuples
451+
# In base command class Lister in cliff, abstract method take_action()
452+
# returns a tuple containing the column names and an iterable
453+
# containing the data to be listed.
452454
columns, data = self.cmd.take_action(parsed_args)
453455

454456
self.users_mock.list.assert_called_with(tenant_id=None)
@@ -466,7 +468,9 @@ def test_user_list_project(self):
466468
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
467469
project_id = identity_fakes.PROJECT_2['id']
468470

469-
# DisplayCommandBase.take_action() returns two tuples
471+
# In base command class Lister in cliff, abstract method take_action()
472+
# returns a tuple containing the column names and an iterable
473+
# containing the data to be listed.
470474
columns, data = self.cmd.take_action(parsed_args)
471475

472476
self.users_mock.list.assert_called_with(tenant_id=project_id)
@@ -483,7 +487,9 @@ def test_user_list_long(self):
483487
]
484488
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
485489

486-
# DisplayCommandBase.take_action() returns two tuples
490+
# In base command class Lister in cliff, abstract method take_action()
491+
# returns a tuple containing the column names and an iterable
492+
# containing the data to be listed.
487493
columns, data = self.cmd.take_action(parsed_args)
488494

489495
self.users_mock.list.assert_called_with(tenant_id=None)

openstackclient/tests/identity/v3/test_catalog.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ def test_catalog_list(self):
6868
verifylist = []
6969
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
7070

71-
# DisplayCommandBase.take_action() returns two tuples
71+
# In base command class Lister in cliff, abstract method take_action()
72+
# returns a tuple containing the column names and an iterable
73+
# containing the data to be listed.
7274
columns, data = self.cmd.take_action(parsed_args)
7375
self.sc_mock.service_catalog.get_data.assert_called_with()
7476

openstackclient/tests/identity/v3/test_consumer.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,9 @@ def test_consumer_list(self):
121121
verifylist = []
122122
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
123123

124-
# DisplayCommandBase.take_action() returns two tuples
124+
# In base command class Lister in cliff, abstract method take_action()
125+
# returns a tuple containing the column names and an iterable
126+
# containing the data to be listed.
125127
columns, data = self.cmd.take_action(parsed_args)
126128
self.consumers_mock.list.assert_called_with()
127129

openstackclient/tests/identity/v3/test_domain.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,9 @@ def test_domain_list_no_options(self):
215215
verifylist = []
216216
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
217217

218-
# DisplayCommandBase.take_action() returns two tuples
218+
# In base command class Lister in cliff, abstract method take_action()
219+
# returns a tuple containing the column names and an iterable
220+
# containing the data to be listed.
219221
columns, data = self.cmd.take_action(parsed_args)
220222
self.domains_mock.list.assert_called_with()
221223

openstackclient/tests/identity/v3/test_endpoint.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,9 @@ def test_endpoint_list_no_options(self):
315315
verifylist = []
316316
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
317317

318-
# DisplayCommandBase.take_action() returns two tuples
318+
# In base command class Lister in cliff, abstract method take_action()
319+
# returns a tuple containing the column names and an iterable
320+
# containing the data to be listed.
319321
columns, data = self.cmd.take_action(parsed_args)
320322
self.endpoints_mock.list.assert_called_with()
321323

@@ -342,7 +344,9 @@ def test_endpoint_list_service(self):
342344
]
343345
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
344346

345-
# DisplayCommandBase.take_action() returns two tuples
347+
# In base command class Lister in cliff, abstract method take_action()
348+
# returns a tuple containing the column names and an iterable
349+
# containing the data to be listed.
346350
columns, data = self.cmd.take_action(parsed_args)
347351

348352
# Set expected values
@@ -374,7 +378,9 @@ def test_endpoint_list_interface(self):
374378
]
375379
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
376380

377-
# DisplayCommandBase.take_action() returns two tuples
381+
# In base command class Lister in cliff, abstract method take_action()
382+
# returns a tuple containing the column names and an iterable
383+
# containing the data to be listed.
378384
columns, data = self.cmd.take_action(parsed_args)
379385

380386
# Set expected values
@@ -406,7 +412,9 @@ def test_endpoint_list_region(self):
406412
]
407413
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
408414

409-
# DisplayCommandBase.take_action() returns two tuples
415+
# In base command class Lister in cliff, abstract method take_action()
416+
# returns a tuple containing the column names and an iterable
417+
# containing the data to be listed.
410418
columns, data = self.cmd.take_action(parsed_args)
411419

412420
# Set expected values

0 commit comments

Comments
 (0)