Skip to content

Commit 43f8050

Browse files
author
Tang Chen
committed
Fix DisplayCommandBase comments for cliff Command 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 1 in all but identity tests. There are too many such comments in identity tests. So fix them all in another patch. Change-Id: I9849baa8141ea8af2042a69afd540b77ce6ae6bd Partial-bug: #1477199
1 parent 624c39a commit 43f8050

3 files changed

Lines changed: 0 additions & 22 deletions

File tree

openstackclient/tests/image/v1/test_image.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,6 @@ def test_image_delete_no_options(self):
230230
]
231231
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
232232

233-
# DisplayCommandBase.take_action() returns two tuples
234233
self.cmd.take_action(parsed_args)
235234

236235
self.images_mock.delete.assert_called_with(
@@ -456,7 +455,6 @@ def test_image_set_no_options(self):
456455
]
457456
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
458457

459-
# DisplayCommandBase.take_action() returns two tuples
460458
self.cmd.take_action(parsed_args)
461459

462460
# Verify update() was not called, if it was show the args
@@ -517,7 +515,6 @@ def test_image_set_bools1(self):
517515
]
518516
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
519517

520-
# DisplayCommandBase.take_action() returns two tuples
521518
self.cmd.take_action(parsed_args)
522519

523520
kwargs = {
@@ -545,7 +542,6 @@ def test_image_set_bools2(self):
545542
]
546543
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
547544

548-
# DisplayCommandBase.take_action() returns two tuples
549545
self.cmd.take_action(parsed_args)
550546

551547
kwargs = {
@@ -570,7 +566,6 @@ def test_image_set_properties(self):
570566
]
571567
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
572568

573-
# DisplayCommandBase.take_action() returns two tuples
574569
self.cmd.take_action(parsed_args)
575570

576571
kwargs = {

openstackclient/tests/image/v2/test_image.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,6 @@ def test_image_delete_no_options(self):
435435
]
436436
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
437437

438-
# DisplayCommandBase.take_action() returns two tuples
439438
self.cmd.take_action(parsed_args)
440439

441440
self.images_mock.delete.assert_called_with(
@@ -730,7 +729,6 @@ def test_remove_project_image_no_options(self):
730729
]
731730
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
732731

733-
# DisplayCommandBase.take_action() returns two tuples
734732
self.cmd.take_action(parsed_args)
735733
self.image_members_mock.delete.assert_called_with(
736734
image_fakes.image_id,
@@ -750,7 +748,6 @@ def test_remove_project_image_with_options(self):
750748
]
751749
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
752750

753-
# DisplayCommandBase.take_action() returns two tuples
754751
self.cmd.take_action(parsed_args)
755752
self.image_members_mock.delete.assert_called_with(
756753
image_fakes.image_id,
@@ -808,7 +805,6 @@ def test_image_set_options(self):
808805
]
809806
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
810807

811-
# DisplayCommandBase.take_action() returns two tuples
812808
self.cmd.take_action(parsed_args)
813809

814810
kwargs = {
@@ -876,7 +872,6 @@ def test_image_set_bools1(self):
876872
]
877873
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
878874

879-
# DisplayCommandBase.take_action() returns two tuples
880875
self.cmd.take_action(parsed_args)
881876

882877
kwargs = {
@@ -904,7 +899,6 @@ def test_image_set_bools2(self):
904899
]
905900
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
906901

907-
# DisplayCommandBase.take_action() returns two tuples
908902
self.cmd.take_action(parsed_args)
909903

910904
kwargs = {
@@ -929,7 +923,6 @@ def test_image_set_properties(self):
929923
]
930924
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
931925

932-
# DisplayCommandBase.take_action() returns two tuples
933926
self.cmd.take_action(parsed_args)
934927

935928
kwargs = {
@@ -963,7 +956,6 @@ def test_image_set_fake_properties(self):
963956
]
964957
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
965958

966-
# DisplayCommandBase.take_action() returns two tuples
967959
self.cmd.take_action(parsed_args)
968960

969961
kwargs = {
@@ -991,7 +983,6 @@ def test_image_set_tag(self):
991983
]
992984
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
993985

994-
# DisplayCommandBase.take_action() returns two tuples
995986
self.cmd.take_action(parsed_args)
996987

997988
kwargs = {
@@ -1015,7 +1006,6 @@ def test_image_set_activate(self):
10151006
]
10161007
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
10171008

1018-
# DisplayCommandBase.take_action() returns two tuples
10191009
self.cmd.take_action(parsed_args)
10201010

10211011
kwargs = {
@@ -1044,7 +1034,6 @@ def test_image_set_deactivate(self):
10441034
]
10451035
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
10461036

1047-
# DisplayCommandBase.take_action() returns two tuples
10481037
self.cmd.take_action(parsed_args)
10491038

10501039
kwargs = {
@@ -1075,7 +1064,6 @@ def test_image_set_tag_merge(self):
10751064
]
10761065
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
10771066

1078-
# DisplayCommandBase.take_action() returns two tuples
10791067
self.cmd.take_action(parsed_args)
10801068

10811069
kwargs = {
@@ -1101,7 +1089,6 @@ def test_image_set_tag_merge_dupe(self):
11011089
]
11021090
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
11031091

1104-
# DisplayCommandBase.take_action() returns two tuples
11051092
self.cmd.take_action(parsed_args)
11061093

11071094
kwargs = {

openstackclient/tests/volume/v1/test_volume.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,6 @@ def test_volume_set_name(self):
582582
]
583583
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
584584

585-
# DisplayCommandBase.take_action() returns two tuples
586585
self.cmd.take_action(parsed_args)
587586

588587
# Set expected values
@@ -608,7 +607,6 @@ def test_volume_set_description(self):
608607
]
609608
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
610609

611-
# DisplayCommandBase.take_action() returns two tuples
612610
self.cmd.take_action(parsed_args)
613611

614612
# Set expected values
@@ -634,7 +632,6 @@ def test_volume_set_size(self):
634632
]
635633
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
636634

637-
# DisplayCommandBase.take_action() returns two tuples
638635
self.cmd.take_action(parsed_args)
639636

640637
# Set expected values
@@ -700,7 +697,6 @@ def test_volume_set_property(self):
700697
]
701698
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
702699

703-
# DisplayCommandBase.take_action() returns two tuples
704700
self.cmd.take_action(parsed_args)
705701

706702
# Set expected values

0 commit comments

Comments
 (0)