Remove INSTALLER_IP from Functest
[functest.git] / functest / tests / unit / cli / commands / test_cli_os.py
index e4854cd..a5e562a 100644 (file)
@@ -23,9 +23,9 @@ class CliOpenStackTesting(unittest.TestCase):
         self.endpoint_ip = 'test_ip'
         self.os_auth_url = 'http://test_ip:test_port/v2.0'
         self.installer_type = 'test_installer_type'
-        self.installer_ip = 'test_installer_ip'
-        self.openstack_creds = 'test_openstack_creds'
+        self.openstack_creds = 'test_env_file'
         self.snapshot_file = 'test_snapshot_file'
+        os.environ["OS_AUTH_URL"] = ''
         self.cli_os = cli_os.CliOpenStack()
 
     def test_ping_endpoint_default(self):
@@ -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")
+        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):