Merge "Prohibit the importation of a list of libraries"
[yardstick.git] / tests / unit / network_services / vnf_generic / vnf / test_cgnapt_vnf.py
index 832509e..edaa0ad 100644 (file)
@@ -1,5 +1,3 @@
-#!/usr/bin/env python
-
 # Copyright (c) 2016-2017 Intel Corporation
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # limitations under the License.
 #
 
-from __future__ import absolute_import
-
+from copy import deepcopy
 import os
 import unittest
 import mock
 
-from copy import deepcopy
-
 from tests.unit import STL_MOCKS
 from tests.unit.network_services.vnf_generic.vnf.test_base import mock_ssh
 
@@ -305,14 +300,14 @@ class TestCgnaptApproxVnf(unittest.TestCase):
     def setUp(self):
         self.scenario_cfg = deepcopy(self.SCENARIO_CFG)
 
-    def test___init__(self, mock_process):
+    def test___init__(self, *args):
         vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
         cgnapt_approx_vnf = CgnaptApproxVnf(name, vnfd)
         self.assertIsNone(cgnapt_approx_vnf._vnf_process)
 
     @mock.patch('yardstick.network_services.vnf_generic.vnf.sample_vnf.time')
     @mock.patch(SSH_HELPER)
-    def test_collect_kpi(self, ssh, mock_time, mock_process):
+    def test_collect_kpi(self, ssh, *args):
         mock_ssh(ssh)
 
         vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
@@ -328,7 +323,7 @@ class TestCgnaptApproxVnf(unittest.TestCase):
 
     @mock.patch('yardstick.network_services.vnf_generic.vnf.sample_vnf.time')
     @mock.patch(SSH_HELPER)
-    def test_vnf_execute_command(self, ssh, mock_time, mock_process):
+    def test_vnf_execute_command(self, ssh, *args):
         mock_ssh(ssh)
 
         vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
@@ -340,7 +335,7 @@ class TestCgnaptApproxVnf(unittest.TestCase):
         self.assertEqual("", cgnapt_approx_vnf.vnf_execute(cmd))
 
     @mock.patch(SSH_HELPER)
-    def test_get_stats(self, ssh, mock_process):
+    def test_get_stats(self, ssh, *args):
         mock_ssh(ssh)
 
         vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
@@ -362,7 +357,7 @@ class TestCgnaptApproxVnf(unittest.TestCase):
     @mock.patch("yardstick.network_services.vnf_generic.vnf.cgnapt_vnf.eval")
     @mock.patch('yardstick.network_services.vnf_generic.vnf.cgnapt_vnf.open')
     @mock.patch(SSH_HELPER)
-    def test_run_vcgnapt(self, ssh, mock_hex, mock_eval, mock_open, mock_process):
+    def test_run_vcgnapt(self, ssh, *args):
         mock_ssh(ssh)
 
         vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
@@ -377,7 +372,7 @@ class TestCgnaptApproxVnf(unittest.TestCase):
 
     @mock.patch("yardstick.network_services.vnf_generic.vnf.sample_vnf.Context")
     @mock.patch(SSH_HELPER)
-    def test_instantiate(self, ssh, mock_context, mock_process):
+    def test_instantiate(self, ssh, *args):
         mock_ssh(ssh)
 
         vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
@@ -393,31 +388,9 @@ class TestCgnaptApproxVnf(unittest.TestCase):
         self.assertIsNone(cgnapt_approx_vnf.instantiate(self.scenario_cfg,
                                                         self.context_cfg))
 
-    def test_scale(self, mock_process):
-        vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
-        cgnapt_approx_vnf = CgnaptApproxVnf(name, vnfd)
-        flavor = ""
-        self.assertRaises(NotImplementedError, cgnapt_approx_vnf.scale, flavor)
-
     @mock.patch("yardstick.network_services.vnf_generic.vnf.sample_vnf.time")
     @mock.patch(SSH_HELPER)
-    def test_terminate(self, ssh, mock_time, mock_process):
-        mock_ssh(ssh)
-
-        vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
-        cgnapt_approx_vnf = CgnaptApproxVnf(name, vnfd)
-        cgnapt_approx_vnf._vnf_process = mock.MagicMock()
-        cgnapt_approx_vnf._vnf_process.terminate = mock.Mock()
-        cgnapt_approx_vnf.used_drivers = {"01:01.0": "i40e",
-                                          "01:01.1": "i40e"}
-        cgnapt_approx_vnf.vnf_execute = mock.MagicMock()
-        cgnapt_approx_vnf.dpdk_nic_bind = "dpdk_nic_bind.py"
-        cgnapt_approx_vnf._resource_collect_stop = mock.Mock()
-        self.assertEqual(None, cgnapt_approx_vnf.terminate())
-
-    @mock.patch("yardstick.network_services.vnf_generic.vnf.sample_vnf.time")
-    @mock.patch(SSH_HELPER)
-    def test__vnf_up_post(self, ssh, mock_time, mock_process):
+    def test__vnf_up_post(self, ssh, *args):
         mock_ssh(ssh)
 
         vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
@@ -433,7 +406,7 @@ class TestCgnaptApproxVnf(unittest.TestCase):
 
     @mock.patch("yardstick.network_services.vnf_generic.vnf.sample_vnf.time")
     @mock.patch(SSH_HELPER)
-    def test__vnf_up_post_short(self, ssh, mock_time, mock_process):
+    def test__vnf_up_post_short(self, ssh, *args):
         mock_ssh(ssh)
 
         vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
@@ -444,7 +417,3 @@ class TestCgnaptApproxVnf(unittest.TestCase):
         cgnapt_approx_vnf.scenario_helper.scenario_cfg = self.scenario_cfg
         cgnapt_approx_vnf._resource_collect_stop = mock.Mock()
         cgnapt_approx_vnf._vnf_up_post()
-
-
-if __name__ == '__main__':
-    unittest.main()