diff options
author | maopeng zhang <zhang.maopeng1@zte.com.cn> | 2019-04-28 10:28:14 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-04-28 10:28:14 +0000 |
commit | f80b47c1b8fbe3e2eae55b683d5b94d535452828 (patch) | |
tree | 97dba1e221f7723db38e61563382d69fe8a95f61 | |
parent | d226459b9097574cd5d521a243aafc902393bd76 (diff) | |
parent | 7692aff064128d8d03582e4edb1278aea40f3f20 (diff) |
Merge "optimize tests"
-rw-r--r-- | catalog/packages/tests/test_pnf_descriptor.py | 6 | ||||
-rw-r--r-- | catalog/packages/tests/test_vnf_package.py | 5 |
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 9f0cef51..07486cdc 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): |