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
changes/78/760278/1
Koichiro Den 2 years ago
parent 1a98ddf42b
commit 180ff8ae4a
  1. 2
      tacker/objects/__init__.py
  2. 2
      tacker/objects/vnf_lcm_subscriptions.py
  3. 6
      tacker/tests/functional/vnfpkgm/test_vnf_package.py
  4. 4
      tacker/tosca/utils.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')

@ -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,

@ -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):

@ -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)

Loading…
Cancel
Save