optimize tests 75/86475/1
authorhewei-cmss <hewei@cmss.chinamobile.com>
Sun, 28 Apr 2019 09:33:29 +0000 (17:33 +0800)
committerhewei-cmss <hewei@cmss.chinamobile.com>
Sun, 28 Apr 2019 09:33:29 +0000 (17:33 +0800)
Delete test resource in test_pnf_descriptor and
test_vnf_package

Issue-ID: VFC-1368

Change-Id: I2b638ca25a3eab82c56f10aa8b4f40e4b8f66485
Signed-off-by: hewei-cmss <hewei@cmss.chinamobile.com>
catalog/packages/tests/test_pnf_descriptor.py
catalog/packages/tests/test_vnf_package.py

index a722d80..9751518 100644 (file)
@@ -17,6 +17,7 @@ import copy
 import json
 import mock
 import os
+import shutil
 
 
 from django.test import TestCase
@@ -25,6 +26,7 @@ from rest_framework.test import APIClient
 from catalog.packages.biz.pnf_descriptor import PnfDescriptor
 from catalog.packages.const import PKG_STATUS
 from catalog.packages.tests.const import pnfd_data
+from catalog.pub.config.config import CATALOG_ROOT_PATH
 from catalog.pub.database.models import PnfPackageModel, NSPackageModel
 from catalog.pub.utils import toscaparser
 
@@ -55,7 +57,9 @@ class TestPnfDescriptor(TestCase):
         }
 
     def tearDown(self):
-        pass
+        file_path = os.path.join(CATALOG_ROOT_PATH, "22")
+        if os.path.exists(file_path):
+            shutil.rmtree(file_path)
 
     def test_pnfd_create_normal(self):
         request_data = {'userDefinedData': self.user_defined_data}
index e83aa7a..e62c7fa 100644 (file)
@@ -16,6 +16,7 @@ import json
 import os
 import urllib2
 import mock
+import shutil
 
 from django.test import TestCase
 from rest_framework import status
@@ -42,7 +43,9 @@ class TestVnfPackage(TestCase):
         self.client = APIClient()
 
     def tearDown(self):
-        pass
+        file_path = os.path.join(CATALOG_ROOT_PATH, "222")
+        if os.path.exists(file_path):
+            shutil.rmtree(file_path)
 
     @mock.patch.object(toscaparser, 'parse_vnfd')
     def test_upload_vnf_pkg(self, mock_parse_vnfd):