aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--catalog/packages/tests/test_ns_descriptor.py2
-rw-r--r--catalog/packages/tests/test_pnf_descriptor.py6
-rw-r--r--catalog/packages/tests/test_vnf_package.py7
-rw-r--r--catalog/packages/views/ns_descriptor_views.py2
-rw-r--r--catalog/packages/views/vnf_package_views.py2
5 files changed, 13 insertions, 6 deletions
diff --git a/catalog/packages/tests/test_ns_descriptor.py b/catalog/packages/tests/test_ns_descriptor.py
index f26ec394..d156843a 100644
--- a/catalog/packages/tests/test_ns_descriptor.py
+++ b/catalog/packages/tests/test_ns_descriptor.py
@@ -248,7 +248,7 @@ class TestNsDescriptor(TestCase):
response = self.client.get(
"/api/nsd/v1/ns_descriptors/23/nsd_content",
- RANGE='5-10',
+ HTTP_RANGE='5-10',
format='json'
)
partial_file_content = ''
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..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):
@@ -250,7 +253,7 @@ class TestVnfPackage(TestCase):
onboardingState="ONBOARDED",
localFilePath="vnfPackage.csar"
)
- response = self.client.get("/api/vnfpkgm/v1/vnf_packages/222/package_content", RANGE="4-7")
+ response = self.client.get("/api/vnfpkgm/v1/vnf_packages/222/package_content", HTTP_RANGE="4-7")
partial_file_content = ''
for data in response.streaming_content:
partial_file_content = partial_file_content + data
diff --git a/catalog/packages/views/ns_descriptor_views.py b/catalog/packages/views/ns_descriptor_views.py
index 81836d35..73388ee4 100644
--- a/catalog/packages/views/ns_descriptor_views.py
+++ b/catalog/packages/views/ns_descriptor_views.py
@@ -134,6 +134,6 @@ def nsd_content_ru(request, **kwargs):
raise e
if request.method == 'GET':
- file_range = request.META.get('RANGE')
+ file_range = request.META.get('HTTP_RANGE')
file_iterator = NsDescriptor().download(nsd_info_id, file_range)
return StreamingHttpResponse(file_iterator, status=status.HTTP_200_OK)
diff --git a/catalog/packages/views/vnf_package_views.py b/catalog/packages/views/vnf_package_views.py
index 094b6f59..dcff9867 100644
--- a/catalog/packages/views/vnf_package_views.py
+++ b/catalog/packages/views/vnf_package_views.py
@@ -105,7 +105,7 @@ def package_content_ru(request, **kwargs):
raise e
if request.method == "GET":
- file_range = request.META.get('RANGE')
+ file_range = request.META.get('HTTP_RANGE')
file_iterator = VnfPackage().download(vnf_pkg_id, file_range)
return StreamingHttpResponse(file_iterator, status=status.HTTP_200_OK)