summaryrefslogtreecommitdiffstats
path: root/vnftest/steps/rest_call.py
diff options
context:
space:
mode:
authorMoshe <moshehoa@amdocs.com>2019-01-09 09:40:40 +0200
committerMoshe <moshehoa@amdocs.com>2019-01-09 11:53:20 +0200
commitce6df7403af5694aee412836cd3c86e33307e190 (patch)
treecd9799665cba2c44e517419d4d5570f2198939ff /vnftest/steps/rest_call.py
parent6affd662a7793fda0be64ee103d7239702b9722b (diff)
refactor input parameters handling
Change-Id: I599be7b0c0f9724f954fb4790dcd7d03538fdcb7 Issue-ID: VNFSDK-350 Signed-off-by: Moshe <moshehoa@amdocs.com> fix test Issue-ID: VNFSDK-350 Change-Id: I8f3c0b80220e88660f0a0d00c1207abd30ed2208 Signed-off-by: Moshe <moshehoa@amdocs.com> fix test Issue-ID: VNFSDK-350 Change-Id: Ica479453d60129ed033dfcf613dbe73bb1c60bd0 Signed-off-by: Moshe <moshehoa@amdocs.com> fix test Issue-ID: VNFSDK-350 Change-Id: If9470517623074708e1c602b4683a958227d16c6 Signed-off-by: Moshe <moshehoa@amdocs.com>
Diffstat (limited to 'vnftest/steps/rest_call.py')
-rw-r--r--vnftest/steps/rest_call.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/vnftest/steps/rest_call.py b/vnftest/steps/rest_call.py
index f8b1cf7..7b034ec 100644
--- a/vnftest/steps/rest_call.py
+++ b/vnftest/steps/rest_call.py
@@ -54,10 +54,6 @@ class RestCall(base.Step):
self.input_cfg = options.get("input", {})
self.output_cfg = options.get("output", {})
self.sla_cfg = self.step_cfg.get('sla', {'retries': 0})
- context_dict = {}
- context_dict['creds'] = dotdict(self.context.creds)
- context_dict['vnf_descriptor'] = dotdict(self.context.vnf_descriptor)
- self.input_params['context'] = dotdict(context_dict)
self.setup_done = True
def eval_input(self, params):
@@ -90,10 +86,12 @@ class RestCall(base.Step):
def run_impl(self, result):
if not self.setup_done:
self.setup()
- params = copy.deepcopy(self.context.onap_env_config)
+ params = {}
+ params.update(copy.deepcopy(self.input_params))
self.eval_input(params)
execution_result = self.execute_operation(params)
result_body = execution_result['body']
+ result_body['headers'] = execution_result.get('headers', {})
output = Crawler.crawl(result_body, self.output_cfg)
result.update(output)
return output
@@ -122,9 +120,9 @@ class RestCall(base.Step):
LOG.info(headers)
LOG.info(body)
if 'file' in operation:
- file_path = operation['file']
- LOG.info(file_path)
- files = {'upload': open(file_path)}
+ file_conf = operation['file']
+ LOG.info(file_conf)
+ files = {file_conf['key']: open(file_conf['path'])}
result = rest_client.upload_file(url, headers, files, LOG)
else:
result = rest_client.call(url,