Update unit test related to vyos_vrouter
authorMorgan Richomme <morgan.richomme@orange.com>
Wed, 11 Oct 2017 11:44:47 +0000 (13:44 +0200)
committerCédric Ollivier <cedric.ollivier@orange.com>
Wed, 15 Nov 2017 07:51:41 +0000 (08:51 +0100)
Utilvnf is now mocked to stop triggering the git clone of an
external repo and creating dirs.
Else we may get errors when testing offline.

Co-Authored-By: Cédric Ollivier <cedric.ollivier@orange.com>
Change-Id: Ia7e86593ecca9b9add747ef89b1d5e8d6bdb2d7c
Signed-off-by: Morgan Richomme <morgan.richomme@orange.com>
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
functest/tests/unit/vnf/router/test_cloudify_vrouter.py

index 4f25623..4d8e940 100644 (file)
@@ -18,7 +18,11 @@ from functest.opnfv_tests.vnf.router import cloudify_vrouter
 
 class CloudifyVrouterTesting(unittest.TestCase):
 
-    def setUp(self):
+    @mock.patch('functest.opnfv_tests.vnf.router.cloudify_vrouter.Utilvnf')
+    @mock.patch('functest.opnfv_tests.vnf.router.cloudify_vrouter.vrouter_base'
+                '.Utilvnf')
+    @mock.patch('os.makedirs')
+    def setUp(self, *args):
 
         self.tenant = 'cloudify_vrouter'
         self.creds = {'username': 'user',
@@ -41,14 +45,12 @@ class CloudifyVrouterTesting(unittest.TestCase):
                                                      'ram_min': 2048}}}}
 
         with mock.patch('functest.opnfv_tests.vnf.router.cloudify_vrouter.'
-                        'os.makedirs'), \
-            mock.patch('functest.opnfv_tests.vnf.router.cloudify_vrouter.'
-                       'get_config', return_value={
-                           'tenant_images': 'foo',
-                           'orchestrator': self.orchestrator,
-                           'vnf': self.vnf,
-                           'vnf_test_suite': '',
-                           'version': 'whatever'}):
+                        'get_config', return_value={
+                            'tenant_images': 'foo',
+                            'orchestrator': self.orchestrator,
+                            'vnf': self.vnf,
+                            'vnf_test_suite': '',
+                            'version': 'whatever'}):
 
             self.router_vnf = cloudify_vrouter.CloudifyVrouter()