summaryrefslogtreecommitdiff
path: root/heatclient/tests/unit/osc/v1/test_stack.py
diff options
context:
space:
mode:
authorrabi <ramishra@redhat.com>2016-11-30 09:01:34 +0530
committerrabi <ramishra@redhat.com>2016-12-14 12:16:42 +0530
commit280b1edeeab3a9746ec6674d23fb7ea95b4b46fc (patch)
treeb3056e61771f817341d436a5eb008f818a448fe8 /heatclient/tests/unit/osc/v1/test_stack.py
parent2f4feffd7347f1f00f86e83c8b4ab0db986e4858 (diff)
downloadpython-heatclient-280b1edeeab3a9746ec6674d23fb7ea95b4b46fc.tar.gz
User server side env merging with osc plugin
With osc client plugin, we don't seem to use server side env merging for stack create and update. However, it's there for template validation. This patch brings it in sync with heat cli. Change-Id: I8973fa499c51ca5f789efa6fb5c07bb6302324d7 Related-Bug: #1645686
Diffstat (limited to 'heatclient/tests/unit/osc/v1/test_stack.py')
-rw-r--r--heatclient/tests/unit/osc/v1/test_stack.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/heatclient/tests/unit/osc/v1/test_stack.py b/heatclient/tests/unit/osc/v1/test_stack.py
index d2ee28c..c40bdf1 100644
--- a/heatclient/tests/unit/osc/v1/test_stack.py
+++ b/heatclient/tests/unit/osc/v1/test_stack.py
@@ -43,6 +43,7 @@ class TestStack(orchestration_fakes.TestOrchestrationv1):
class TestStackCreate(TestStack):
template_path = 'heatclient/tests/test_templates/empty.yaml'
+ env_path = 'heatclient/tests/unit/var/environment.json'
defaults = {
'stack_name': 'my_stack',
@@ -71,6 +72,16 @@ class TestStackCreate(TestStack):
self.stack_client.create.assert_called_with(**self.defaults)
+ def test_stack_create_with_env(self):
+ arglist = ['my_stack', '-t', self.template_path, '-e', self.env_path]
+ parsed_args = self.check_parser(self.cmd, arglist, [])
+ self.cmd.take_action(parsed_args)
+
+ self.assertEqual(1, self.stack_client.create.call_count)
+ args = self.stack_client.create.call_args[1]
+ self.assertEqual({'parameters': {}}, args.get('environment'))
+ self.assertIn(self.env_path, args.get('environment_files')[0])
+
def test_stack_create_rollback(self):
arglist = ['my_stack', '-t', self.template_path, '--enable-rollback']
kwargs = copy.deepcopy(self.defaults)
@@ -162,6 +173,7 @@ class TestStackCreate(TestStack):
class TestStackUpdate(TestStack):
template_path = 'heatclient/tests/test_templates/empty.yaml'
+ env_path = 'heatclient/tests/unit/var/environment.json'
defaults = {
'stack_id': 'my_stack',
@@ -193,6 +205,16 @@ class TestStackUpdate(TestStack):
self.stack_client.update.assert_called_with(**self.defaults)
+ def test_stack_update_with_env(self):
+ arglist = ['my_stack', '-t', self.template_path, '-e', self.env_path]
+ parsed_args = self.check_parser(self.cmd, arglist, [])
+ self.cmd.take_action(parsed_args)
+
+ self.assertEqual(1, self.stack_client.update.call_count)
+ args = self.stack_client.update.call_args[1]
+ self.assertEqual({'parameters': {}}, args.get('environment'))
+ self.assertIn(self.env_path, args.get('environment_files')[0])
+
def test_stack_update_rollback_enabled(self):
arglist = ['my_stack', '-t', self.template_path, '--rollback',
'enabled']