Fixing Mistral HTTP action to take care of empty headers
Change-Id: I420ba7ca4a14118d397440db6e2629dec539aee8 Closes-bug: #1335769
This commit is contained in:
parent
1933b7d555
commit
83c79bc89d
13
AUTHORS
13
AUTHORS
@ -1,4 +1,13 @@
|
||||
Renat Akhmerov <rakhmerov@mirantis.com>
|
||||
Nikolay Makhotkin <nmakhotkin@mirantis.com>
|
||||
Alexander Kuznetsov <akuznetsov@mirantis.com>
|
||||
Angus Salkeld <angus.salkeld@rackspace.com>
|
||||
Dmitri Zimine <dz@stackstorm.com>
|
||||
Kirill Izotov <enykeev@stackstorm.com>
|
||||
Manas Kelshikar <manas@stackstorm.com>
|
||||
Nikolay Mahotkin <nmakhotkin@mirantis.com>
|
||||
Renat Akhmerov <rakhmerov@mirantis.com>
|
||||
Sergey Kolekonov <skolekonov@mirantis.com>
|
||||
Sergey Murashov <smurashov@mirantis.com>
|
||||
Timur Nurlygayanov <tnurlygayanov@mirantis.com>
|
||||
Winson Chan <m4d.coder@gmail.com>
|
||||
|
||||
|
||||
|
@ -163,6 +163,7 @@ class MistralHTTPAction(HTTPAction):
|
||||
timeout=None,
|
||||
allow_redirects=None,
|
||||
proxies=None):
|
||||
headers = headers or {}
|
||||
headers.update({
|
||||
'Mistral-Workbook-Name': action_context['workbook_name'],
|
||||
'Mistral-Execution-Id': action_context['execution_id'],
|
||||
|
@ -150,14 +150,38 @@ class ActionFactoryTest(base.BaseTest):
|
||||
self.assertEqual(task_params['headers'], action.headers)
|
||||
self.assertDictEqual(task_params['body'], json.loads(action.body))
|
||||
|
||||
headers = task_params['headers']
|
||||
self.assertEqual(db_task['workbook_name'],
|
||||
action.headers['Mistral-Workbook-Name'])
|
||||
self.assertEqual(db_task['execution_id'],
|
||||
action.headers['Mistral-Execution-Id'])
|
||||
self.assertEqual(db_task['id'],
|
||||
action.headers['Mistral-Task-Id'])
|
||||
|
||||
def test_create_mistral_http_action_with_no_headers(self):
|
||||
db_task = copy.copy(DB_TASK)
|
||||
db_task['task_spec']['action'] = 'std.mistral_http'
|
||||
|
||||
del db_task['parameters']['headers']
|
||||
|
||||
action = a_f.create_action(db_task)
|
||||
|
||||
self.assertIsNotNone(action)
|
||||
|
||||
task_params = db_task['parameters']
|
||||
|
||||
self.assertEqual(task_params['url'], action.url)
|
||||
self.assertDictEqual(task_params['params'], action.params)
|
||||
self.assertEqual(task_params['method'], action.method)
|
||||
self.assertDictEqual(task_params['body'], json.loads(action.body))
|
||||
|
||||
self.assertIsNotNone(action.headers)
|
||||
|
||||
self.assertEqual(db_task['workbook_name'],
|
||||
headers['Mistral-Workbook-Name'])
|
||||
action.headers['Mistral-Workbook-Name'])
|
||||
self.assertEqual(db_task['execution_id'],
|
||||
headers['Mistral-Execution-Id'])
|
||||
action.headers['Mistral-Execution-Id'])
|
||||
self.assertEqual(db_task['id'],
|
||||
headers['Mistral-Task-Id'])
|
||||
action.headers['Mistral-Task-Id'])
|
||||
|
||||
def test_create_adhoc_action_with_openstack_context(self):
|
||||
db_task = copy.copy(DB_TASK_ADHOC)
|
||||
|
Loading…
Reference in New Issue
Block a user