aboutsummaryrefslogtreecommitdiffstats
path: root/functest/tests
diff options
context:
space:
mode:
authorjose.lausuch <jose.lausuch@ericsson.com>2017-07-07 14:19:39 +0200
committerjose.lausuch <jose.lausuch@ericsson.com>2017-07-12 11:05:25 +0200
commit3bb72f47f704f25d957d8f00b82360fe8b6b2f7a (patch)
tree0050246af7d2d727fd7ea568b62fb59e0e554de0 /functest/tests
parent5b6b314d4c36dbe6e8da4e7d2d2813356397ef77 (diff)
Switch to check_deployment instead of check_os.sh
Change-Id: Idcc67643f813068c3cd06f4c0dfd3289bb7df138 Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
Diffstat (limited to 'functest/tests')
-rw-r--r--functest/tests/unit/ci/test_prepare_env.py24
-rw-r--r--functest/tests/unit/cli/commands/test_cli_os.py10
2 files changed, 15 insertions, 19 deletions
diff --git a/functest/tests/unit/ci/test_prepare_env.py b/functest/tests/unit/ci/test_prepare_env.py
index 7d4b5fb2..7d5fa564 100644
--- a/functest/tests/unit/ci/test_prepare_env.py
+++ b/functest/tests/unit/ci/test_prepare_env.py
@@ -309,22 +309,18 @@ class PrepareEnvTesting(unittest.TestCase):
prepare_env.update_config_file()
self.assertTrue(mock_db_url.called)
- @mock.patch('functest.ci.prepare_env.logger.info')
- def test_verify_deployment_error(self, mock_logger_error):
- mock_popen = mock.Mock()
- attrs = {'poll.return_value': None,
- 'stdout.readline.return_value': 'ERROR'}
- mock_popen.configure_mock(**attrs)
+ def test_verify_deployment(self):
+ with mock.patch('functest.ci.check_deployment.CheckDeployment') \
+ as mock_check_deployment:
+ prepare_env.verify_deployment()
+ self.assertTrue(mock_check_deployment.called)
- with mock.patch('functest.ci.prepare_env.print_separator') as m, \
- mock.patch('functest.ci.prepare_env.subprocess.Popen',
- return_value=mock_popen), \
- self.assertRaises(Exception) as context:
+ def test_verify_deployment_error(self):
+ with mock.patch('functest.ci.prepare_env.'
+ 'check_deployment.CheckDeployment',
+ return_value=('test_', None)), \
+ self.assertRaises(Exception):
prepare_env.verify_deployment()
- self.assertTrue(m.called)
- msg = "Problem while running 'check_os.sh'."
- mock_logger_error.assert_called_once_with('ERROR')
- self.assertTrue(msg in context)
def _get_rally_creds(self):
return {"type": "ExistingCloud",
diff --git a/functest/tests/unit/cli/commands/test_cli_os.py b/functest/tests/unit/cli/commands/test_cli_os.py
index a3d930de..806bc931 100644
--- a/functest/tests/unit/cli/commands/test_cli_os.py
+++ b/functest/tests/unit/cli/commands/test_cli_os.py
@@ -59,12 +59,12 @@ class CliOpenStackTesting(unittest.TestCase):
self.endpoint_ip)
mock_exit.assert_called_once_with(0)
- @mock.patch('functest.cli.commands.cli_os.ft_utils.execute_command')
- def test_check(self, mock_ftutils_execute):
- with mock.patch.object(self.cli_os, 'ping_endpoint'):
+ def test_check(self):
+ with mock.patch.object(self.cli_os, 'ping_endpoint'), \
+ mock.patch('functest.cli.commands.cli_os.check_deployment.'
+ 'CheckDeployment') as mock_check_deployment:
self.cli_os.check()
- mock_ftutils_execute.assert_called_once_with(
- "check_os.sh", verbose=False)
+ self.assertTrue(mock_check_deployment.called)
@mock.patch('functest.cli.commands.cli_os.os.path.isfile',
return_value=False)