1# Licensed under the Apache License, Version 2.0 (the "License"); you may 2# not use this file except in compliance with the License. You may obtain 3# a copy of the License at 4# 5# http://www.apache.org/licenses/LICENSE-2.0 6# 7# Unless required by applicable law or agreed to in writing, software 8# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10# License for the specific language governing permissions and limitations 11# under the License. 12 13from openstack.tests.unit import base 14 15from openstack.orchestration.v1 import stack_environment as se 16 17 18FAKE = { 19 'encrypted_param_names': ['n1', 'n2'], 20 'event_sinks': { 21 's1': 'v1' 22 }, 23 'parameters': { 24 'key_name': { 25 'type': 'string' 26 } 27 }, 28 'parameter_defaults': { 29 'p1': 'def1' 30 }, 31 'resource_registry': { 32 'resources': { 33 'type1': 'type2' 34 } 35 }, 36} 37 38 39class TestStackTemplate(base.TestCase): 40 41 def test_basic(self): 42 sot = se.StackEnvironment() 43 self.assertFalse(sot.allow_create) 44 self.assertTrue(sot.allow_fetch) 45 self.assertFalse(sot.allow_commit) 46 self.assertFalse(sot.allow_delete) 47 self.assertFalse(sot.allow_list) 48 49 def test_make_it(self): 50 sot = se.StackEnvironment(**FAKE) 51 self.assertEqual(FAKE['encrypted_param_names'], 52 sot.encrypted_param_names) 53 self.assertEqual(FAKE['event_sinks'], sot.event_sinks) 54 self.assertEqual(FAKE['parameters'], sot.parameters) 55 self.assertEqual(FAKE['parameter_defaults'], sot.parameter_defaults) 56 self.assertEqual(FAKE['resource_registry'], sot.resource_registry) 57