aboutsummaryrefslogtreecommitdiffstats
path: root/functest/tests
diff options
context:
space:
mode:
Diffstat (limited to 'functest/tests')
-rw-r--r--functest/tests/unit/ci/test_check_deployment.py17
-rw-r--r--functest/tests/unit/openstack/rally/test_rally.py5
2 files changed, 18 insertions, 4 deletions
diff --git a/functest/tests/unit/ci/test_check_deployment.py b/functest/tests/unit/ci/test_check_deployment.py
index 1f44d0787..24e3ce53c 100644
--- a/functest/tests/unit/ci/test_check_deployment.py
+++ b/functest/tests/unit/ci/test_check_deployment.py
@@ -170,6 +170,23 @@ class CheckDeploymentTesting(unittest.TestCase):
self.assertRaises(Exception)
self.assertTrue(m.called)
+ @mock.patch('functest.ci.check_deployment.LOGGER.info')
+ @mock.patch('functest.opnfv_tests.openstack.snaps.snaps_utils.'
+ 'get_ext_net_name', return_value='ext-net')
+ def test_check_extnet(self, mock_getext, mock_loginfo):
+ self.deployment.check_ext_net()
+ self.assertTrue(mock_getext.called)
+ mock_loginfo.assert_called_once_with("External network found: ext-net")
+
+ @mock.patch('functest.opnfv_tests.openstack.snaps.snaps_utils.'
+ 'get_ext_net_name', return_value='')
+ def test_check_extnet_None(self, mock_getext):
+ with self.assertRaises(Exception) as context:
+ self.deployment.check_ext_net()
+ self.assertTrue(mock_getext.called)
+ msg = 'ERROR: No external networks in the deployment.'
+ self.assertTrue(msg in context)
+
if __name__ == "__main__":
logging.disable(logging.CRITICAL)
diff --git a/functest/tests/unit/openstack/rally/test_rally.py b/functest/tests/unit/openstack/rally/test_rally.py
index 83f0c86a3..450eb85bc 100644
--- a/functest/tests/unit/openstack/rally/test_rally.py
+++ b/functest/tests/unit/openstack/rally/test_rally.py
@@ -260,13 +260,10 @@ class OSRallyTesting(unittest.TestCase):
return_value=True)
@mock.patch('functest.opnfv_tests.openstack.rally.rally.subprocess.Popen')
@mock.patch('functest.opnfv_tests.openstack.rally.rally.os.makedirs')
- @mock.patch('functest.opnfv_tests.openstack.rally.rally.os.popen')
@mock.patch('functest.opnfv_tests.openstack.rally.rally.LOGGER.info')
@mock.patch('functest.opnfv_tests.openstack.rally.rally.LOGGER.error')
def test_run_task_default(self, mock_logger_error, mock_logger_info,
- mock_popen, *args):
- attrs = {'read.return_value': 'json_result'}
- mock_popen.return_value.configure_mock(**attrs)
+ *args):
self.rally_base._run_task('test_name')
text = 'Test scenario: "test_name" OK.\n'
mock_logger_info.assert_any_call(text)