From b9de23d906a0ba640c336006e1b373a079846995 Mon Sep 17 00:00:00 2001
From: Tang Chen <chen.tang@easystack.cn>
Date: Sat, 6 Feb 2016 09:34:51 +0800
Subject: [PATCH] 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
---
 openstackclient/tests/compute/v2/test_server.py  | 9 ---------
 openstackclient/tests/compute/v2/test_service.py | 1 -
 2 files changed, 10 deletions(-)

diff --git a/openstackclient/tests/compute/v2/test_server.py b/openstackclient/tests/compute/v2/test_server.py
index 141e137000..da5fc76fdc 100644
--- a/openstackclient/tests/compute/v2/test_server.py
+++ b/openstackclient/tests/compute/v2/test_server.py
@@ -79,7 +79,6 @@ class TestServer(compute_fakes.TestComputev2):
         ]
         parsed_args = self.check_parser(self.cmd, arglist, verifylist)
 
-        # DisplayCommandBase.take_action() returns two tuples
         self.cmd.take_action(parsed_args)
 
         for s in servers:
@@ -411,7 +410,6 @@ class TestServerDelete(TestServer):
         ]
         parsed_args = self.check_parser(self.cmd, arglist, verifylist)
 
-        # DisplayCommandBase.take_action() returns two tuples
         self.cmd.take_action(parsed_args)
 
         self.servers_mock.delete.assert_called_with(
@@ -431,7 +429,6 @@ class TestServerDelete(TestServer):
         ]
         parsed_args = self.check_parser(self.cmd, arglist, verifylist)
 
-        # DisplayCommandBase.take_action() returns two tuples
         self.cmd.take_action(parsed_args)
 
         calls = []
@@ -451,7 +448,6 @@ class TestServerDelete(TestServer):
         ]
         parsed_args = self.check_parser(self.cmd, arglist, verifylist)
 
-        # DisplayCommandBase.take_action() returns two tuples
         self.cmd.take_action(parsed_args)
 
         self.servers_mock.delete.assert_called_with(
@@ -476,7 +472,6 @@ class TestServerDelete(TestServer):
         ]
         parsed_args = self.check_parser(self.cmd, arglist, verifylist)
 
-        # DisplayCommandBase.take_action() returns two tuples
         self.assertRaises(SystemExit, self.cmd.take_action, parsed_args)
 
         self.servers_mock.delete.assert_called_with(
@@ -861,7 +856,6 @@ class TestServerResize(TestServer):
         ]
         parsed_args = self.check_parser(self.cmd, arglist, verifylist)
 
-        # DisplayCommandBase.take_action() returns two tuples
         self.cmd.take_action(parsed_args)
 
         self.servers_mock.get.assert_called_with(
@@ -885,7 +879,6 @@ class TestServerResize(TestServer):
         ]
         parsed_args = self.check_parser(self.cmd, arglist, verifylist)
 
-        # DisplayCommandBase.take_action() returns two tuples
         self.cmd.take_action(parsed_args)
 
         self.servers_mock.get.assert_called_with(
@@ -914,7 +907,6 @@ class TestServerResize(TestServer):
         ]
         parsed_args = self.check_parser(self.cmd, arglist, verifylist)
 
-        # DisplayCommandBase.take_action() returns two tuples
         self.cmd.take_action(parsed_args)
 
         self.servers_mock.get.assert_called_with(
@@ -939,7 +931,6 @@ class TestServerResize(TestServer):
         ]
         parsed_args = self.check_parser(self.cmd, arglist, verifylist)
 
-        # DisplayCommandBase.take_action() returns two tuples
         self.cmd.take_action(parsed_args)
 
         self.servers_mock.get.assert_called_with(
diff --git a/openstackclient/tests/compute/v2/test_service.py b/openstackclient/tests/compute/v2/test_service.py
index 380fbc4f3b..c9c45c1fa4 100644
--- a/openstackclient/tests/compute/v2/test_service.py
+++ b/openstackclient/tests/compute/v2/test_service.py
@@ -49,7 +49,6 @@ class TestServiceDelete(TestService):
         ]
         parsed_args = self.check_parser(self.cmd, arglist, verifylist)
 
-        # DisplayCommandBase.take_action() returns two tuples
         self.cmd.take_action(parsed_args)
 
         self.service_mock.delete.assert_called_with(