From bbfe9b09d2b1ac7bfe286311fef83d36c6125c96 Mon Sep 17 00:00:00 2001
From: Cédric Ollivier <cedric.ollivier@orange.com>
Date: Tue, 23 Jan 2018 11:19:41 +0100
Subject: Fix pylint warnings/errors in cli
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

cli_testcase and cli_tier have been refactored to avoid duplicating
code. Then functest/cli and funtest/unit/cli can be added to the list
of modules rated 10/10.

Change-Id: Iec90e806397248a10f39080ec554e3f0a6eda7c1
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
---
 functest/tests/unit/cli/commands/test_cli_os.py | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

(limited to 'functest/tests/unit/cli/commands/test_cli_os.py')

diff --git a/functest/tests/unit/cli/commands/test_cli_os.py b/functest/tests/unit/cli/commands/test_cli_os.py
index e4854cd6..26956e08 100644
--- a/functest/tests/unit/cli/commands/test_cli_os.py
+++ b/functest/tests/unit/cli/commands/test_cli_os.py
@@ -37,27 +37,24 @@ class CliOpenStackTesting(unittest.TestCase):
 
     @mock.patch('functest.cli.commands.cli_os.exit', side_effect=Exception)
     @mock.patch('functest.cli.commands.cli_os.click.echo')
-    def test_ping_endpoint_missing_auth_url(self, mock_click_echo,
-                                            mock_exit):
+    def test_ping_endpoint_auth_url_ko(self, mock_click_echo, mock_exit):
         with self.assertRaises(Exception):
             self.cli_os.os_auth_url = None
             self.cli_os.ping_endpoint()
-            mock_click_echo.assert_called_once_with("Source the OpenStack "
-                                                    "credentials first '. "
-                                                    "$creds'")
+        mock_click_echo.assert_called_once_with(
+            "Source the OpenStack credentials first '. $creds'")
+        mock_exit.assert_called_once_with(0)
 
     @mock.patch('functest.cli.commands.cli_os.exit')
     @mock.patch('functest.cli.commands.cli_os.click.echo')
-    def test_ping_endpoint_os_system_fails(self, mock_click_echo,
-                                           mock_exit):
+    def test_ping_endpoint_system_fails(self, mock_click_echo, mock_exit):
         self.cli_os.os_auth_url = self.os_auth_url
         self.cli_os.endpoint_ip = self.endpoint_ip
         with mock.patch('functest.cli.commands.cli_os.os.system',
                         return_value=1):
             self.cli_os.ping_endpoint()
-            mock_click_echo.assert_called_once_with("Cannot talk to the "
-                                                    "endpoint %s\n" %
-                                                    self.endpoint_ip)
+            mock_click_echo.assert_called_once_with(
+                "Cannot talk to the endpoint %s\n" % self.endpoint_ip)
             mock_exit.assert_called_once_with(0)
 
     def test_check(self):
-- 
cgit