From 180ff8ae4ac5f4f6ca130a11ad875c9e7ae6d7f9 Mon Sep 17 00:00:00 2001 From: Koichiro Den Date: Thu, 29 Oct 2020 12:47:34 +0900 Subject: [PATCH] Minor fixes and clean-ups * eliminate redundant __import__ * fix typo * fix python3 issue * FT: set total sizes to its real full size Related-Bug: #1886213 Change-Id: I940fdc289701023a3f37abb01c3f37dd312f2f7f --- tacker/objects/__init__.py | 2 -- tacker/objects/vnf_lcm_subscriptions.py | 2 +- tacker/tests/functional/vnfpkgm/test_vnf_package.py | 6 +++--- tacker/tosca/utils.py | 4 ++-- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/tacker/objects/__init__.py b/tacker/objects/__init__.py index 9ce0634f2..40c906178 100644 --- a/tacker/objects/__init__.py +++ b/tacker/objects/__init__.py @@ -25,7 +25,6 @@ def register_all(): # function in order for it to be registered by services that may # need to receive it via RPC. __import__('tacker.objects.heal_vnf_request') - __import__('tacker.objects.vnfd') __import__('tacker.objects.vnf_package') __import__('tacker.objects.vnf_package_vnfd') __import__('tacker.objects.vnf_deployment_flavour') @@ -44,5 +43,4 @@ def register_all(): __import__('tacker.objects.scale_vnf_request') __import__('tacker.objects.grant') __import__('tacker.objects.grant_request') - __import__('tacker.objects.vnfd') __import__('tacker.objects.vnfd_attribute') diff --git a/tacker/objects/vnf_lcm_subscriptions.py b/tacker/objects/vnf_lcm_subscriptions.py index 10afd6550..7909d209d 100644 --- a/tacker/objects/vnf_lcm_subscriptions.py +++ b/tacker/objects/vnf_lcm_subscriptions.py @@ -235,7 +235,7 @@ def _vnf_lcm_subscriptions_create(context, values, filter): callbackUri = values.callback_uri if filter: notification_type = filter.get('notificationTypes') - operation_type = filter.get('operationTypese') + operation_type = filter.get('operationTypes') vnf_lcm_subscriptions_id = _vnf_lcm_subscriptions_id_get( context, diff --git a/tacker/tests/functional/vnfpkgm/test_vnf_package.py b/tacker/tests/functional/vnfpkgm/test_vnf_package.py index 5d177cafe..ff9f17ed8 100644 --- a/tacker/tests/functional/vnfpkgm/test_vnf_package.py +++ b/tacker/tests/functional/vnfpkgm/test_vnf_package.py @@ -437,7 +437,7 @@ class VnfPackageTest(base.BaseTackerTest): id=self.package_id1, base_path=self.base_url), "GET", body={}, headers={}) self.assertEqual(200, response[0].status_code) - self.assertEqual('12804503', response[0].headers['Content-Length']) + self.assertEqual('12804568', response[0].headers['Content-Length']) def test_fetch_vnf_package_content_combined_download(self): """Combine two partial downloads using 'Range' requests for csar zip""" @@ -458,7 +458,7 @@ class VnfPackageTest(base.BaseTackerTest): zipf.writestr(file_path, data) # Partial download 2 - range_ = 'bytes=11-12804503' + range_ = 'bytes=11-12804568' headers = {'Range': range_} response_2 = self.http_client.do_request( '{base_path}/{id}/package_content'.format( @@ -471,7 +471,7 @@ class VnfPackageTest(base.BaseTackerTest): size_2 = int(response_2[0].headers['Content-Length']) total_size = size_1 + size_2 self.assertEqual(True, zipfile.is_zipfile(zip_file_path)) - self.assertEqual(12804503, total_size) + self.assertEqual(12804568, total_size) zip_file_path.close() def test_fetch_vnf_package_artifacts(self): diff --git a/tacker/tosca/utils.py b/tacker/tosca/utils.py index c3f222591..9fbdc1c7e 100644 --- a/tacker/tosca/utils.py +++ b/tacker/tosca/utils.py @@ -307,7 +307,7 @@ def _process_query_metadata(metadata, policy, unique_id): def _process_query_metadata_reservation(metadata, policy): query_metadata = dict() - policy_actions = policy.entity_tpl['reservation'].keys() + policy_actions = list(policy.entity_tpl['reservation'].keys()) policy_actions.remove('properties') for action in policy_actions: query_template = [{ @@ -335,7 +335,7 @@ def _process_alarm_actions(vnf, policy): def _process_alarm_actions_for_reservation(vnf, policy): # process alarm url here alarm_actions = dict() - policy_actions = policy.entity_tpl['reservation'].keys() + policy_actions = list(policy.entity_tpl['reservation'].keys()) policy_actions.remove('properties') for action in policy_actions: alarm_url = vnf['attributes'].get(action)