aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhewei-cmss <hewei@cmss.chinamobile.com>2019-04-28 17:33:29 +0800
committerhewei-cmss <hewei@cmss.chinamobile.com>2019-04-28 17:33:29 +0800
commit7692aff064128d8d03582e4edb1278aea40f3f20 (patch)
tree4893fc9fa6aed373523c270bceacb7b6cb4f789f
parentd3ca942ebfd2834a83ba5823b9314b716ba31099 (diff)
optimize tests
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>
-rw-r--r--catalog/packages/tests/test_pnf_descriptor.py6
-rw-r--r--catalog/packages/tests/test_vnf_package.py5
2 files changed, 9 insertions, 2 deletions
diff --git a/catalog/packages/tests/test_pnf_descriptor.py b/catalog/packages/tests/test_pnf_descriptor.py
index a722d805..97515187 100644
--- a/catalog/packages/tests/test_pnf_descriptor.py
+++ b/catalog/packages/tests/test_pnf_descriptor.py
@@ -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}
diff --git a/catalog/packages/tests/test_vnf_package.py b/catalog/packages/tests/test_vnf_package.py
index e83aa7a3..e62c7fa3 100644
--- a/catalog/packages/tests/test_vnf_package.py
+++ b/catalog/packages/tests/test_vnf_package.py
@@ -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):