code refactor for genericparser
[modeling/etsicatalog.git] / genericparser / packages / tests / test_pnf_descriptor.py
index a6da1db..fc32bbe 100644 (file)
@@ -17,7 +17,7 @@ import copy
 import json
 import mock
 import os
-
+import shutil
 
 from django.test import TestCase
 from rest_framework import status
@@ -25,6 +25,7 @@ from rest_framework.test import APIClient
 from genericparser.packages.biz.pnf_descriptor import PnfDescriptor
 from genericparser.packages.const import PKG_STATUS
 from genericparser.packages.tests.const import pnfd_data
+from genericparser.pub.config.config import GENERICPARSER_ROOT_PATH
 from genericparser.pub.database.models import PnfPackageModel, NSPackageModel
 from genericparser.pub.utils import toscaparsers
 
@@ -55,7 +56,9 @@ class TestPnfDescriptor(TestCase):
         }
 
     def tearDown(self):
-        pass
+        file_path = os.path.join(GENERICPARSER_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}
@@ -277,6 +280,6 @@ class TestPnfDescriptor(TestCase):
         PnfPackageModel(pnfPackageId="8", pnfdId="10").save()
         mock_parse_pnfd.return_value = json.JSONEncoder().encode({"c": "d"})
         req_data = {"csarId": "8", "inputs": []}
-        resp = self.client.post("/api/genericparser/v1/parserpnfd", req_data, format='json')
+        resp = self.client.post("/api/parser/v1/parserpnfd", req_data, format='json')
         self.assertEqual(resp.status_code, status.HTTP_202_ACCEPTED)
         self.assertEqual({"model": '{"c": "d"}'}, resp.data)