Remove vfc-catalog useless dependency packages
[vfc/nfvo/catalog.git] / catalog / packages / tests / test_nf.py
index 657806f..131104c 100644 (file)
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
+
 import json
+
 import mock
-from rest_framework import status
-from django.test import TestCase
 from django.test import Client
+from django.test import TestCase
+from rest_framework import status
 
-from catalog.pub.utils import restcall, toscaparser
-from catalog.pub.utils import fileutil
-from catalog.pub.database.models import VnfPackageModel
-from catalog.pub.database.models import JobStatusModel, JobModel
 from catalog.packages.nf_package import NfDistributeThread, NfPkgDeleteThread
-from catalog.packages import nf_package
+from catalog.pub.database.models import JobStatusModel, JobModel
+from catalog.pub.database.models import VnfPackageModel
 from catalog.pub.msapi import sdc
+from catalog.pub.utils import restcall, toscaparser
+
 
 class TestNfPackage(TestCase):
     def setUp(self):
@@ -343,3 +344,9 @@ class TestNfPackage(TestCase):
             {"csarId": "8", "inputs": []}, format='json')
         self.assertEqual(resp.status_code, status.HTTP_202_ACCEPTED)
         self.assertEqual({"model": '{"c": "d"}'}, resp.data)
+
+    def test_vnfd_parse_when_csar_not_exist(self):
+        resp = self.client.post("/api/catalog/v1/parservnfd", 
+            {"csarId": "1", "inputs": []}, format='json')
+        self.assertEqual(resp.status_code, status.HTTP_500_INTERNAL_SERVER_ERROR)
+        self.assertEqual(resp.data, {"error": "VNF CSAR(1) does not exist."})