Skip to content

Commit b9de23d

Browse files
author
Tang Chen
committed
Compute: 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 compute tests. Change-Id: I99ab42a7de69af0e5de802a1bb5aac647245a200 Partial-bug: #1477199
1 parent 794c2a1 commit b9de23d

2 files changed

Lines changed: 0 additions & 10 deletions

File tree

openstackclient/tests/compute/v2/test_server.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ def run_method_with_servers(self, method_name, server_count):
7979
]
8080
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
8181

82-
# DisplayCommandBase.take_action() returns two tuples
8382
self.cmd.take_action(parsed_args)
8483

8584
for s in servers:
@@ -411,7 +410,6 @@ def test_server_delete_no_options(self):
411410
]
412411
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
413412

414-
# DisplayCommandBase.take_action() returns two tuples
415413
self.cmd.take_action(parsed_args)
416414

417415
self.servers_mock.delete.assert_called_with(
@@ -431,7 +429,6 @@ def test_server_delete_multi_servers(self):
431429
]
432430
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
433431

434-
# DisplayCommandBase.take_action() returns two tuples
435432
self.cmd.take_action(parsed_args)
436433

437434
calls = []
@@ -451,7 +448,6 @@ def test_server_delete_wait_ok(self, mock_wait_for_delete):
451448
]
452449
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
453450

454-
# DisplayCommandBase.take_action() returns two tuples
455451
self.cmd.take_action(parsed_args)
456452

457453
self.servers_mock.delete.assert_called_with(
@@ -476,7 +472,6 @@ def test_server_delete_wait_fails(self, mock_wait_for_delete):
476472
]
477473
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
478474

479-
# DisplayCommandBase.take_action() returns two tuples
480475
self.assertRaises(SystemExit, self.cmd.take_action, parsed_args)
481476

482477
self.servers_mock.delete.assert_called_with(
@@ -861,7 +856,6 @@ def test_server_resize_no_options(self):
861856
]
862857
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
863858

864-
# DisplayCommandBase.take_action() returns two tuples
865859
self.cmd.take_action(parsed_args)
866860

867861
self.servers_mock.get.assert_called_with(
@@ -885,7 +879,6 @@ def test_server_resize(self):
885879
]
886880
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
887881

888-
# DisplayCommandBase.take_action() returns two tuples
889882
self.cmd.take_action(parsed_args)
890883

891884
self.servers_mock.get.assert_called_with(
@@ -914,7 +907,6 @@ def test_server_resize_confirm(self):
914907
]
915908
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
916909

917-
# DisplayCommandBase.take_action() returns two tuples
918910
self.cmd.take_action(parsed_args)
919911

920912
self.servers_mock.get.assert_called_with(
@@ -939,7 +931,6 @@ def test_server_resize_revert(self):
939931
]
940932
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
941933

942-
# DisplayCommandBase.take_action() returns two tuples
943934
self.cmd.take_action(parsed_args)
944935

945936
self.servers_mock.get.assert_called_with(

openstackclient/tests/compute/v2/test_service.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ def test_service_delete_no_options(self):
4949
]
5050
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
5151

52-
# DisplayCommandBase.take_action() returns two tuples
5352
self.cmd.take_action(parsed_args)
5453

5554
self.service_mock.delete.assert_called_with(

0 commit comments

Comments
 (0)