Bartosz Górski | ab33b7e | 2013-06-27 00:39:47 -0700 | [diff] [blame] | 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 | |
Bartosz Górski | ab33b7e | 2013-06-27 00:39:47 -0700 | [diff] [blame] | 13 | from tempest.api.orchestration import base |
Ken'ichi Ohmichi | 60680a8 | 2017-03-10 11:03:16 -0800 | [diff] [blame] | 14 | from tempest.lib.common.utils import data_utils |
Ken'ichi Ohmichi | 835a945 | 2017-01-27 18:17:07 -0800 | [diff] [blame] | 15 | from tempest.lib import decorators |
Bartosz Górski | ab33b7e | 2013-06-27 00:39:47 -0700 | [diff] [blame] | 16 | |
| 17 | |
Bartosz Górski | ab33b7e | 2013-06-27 00:39:47 -0700 | [diff] [blame] | 18 | class TemplateYAMLTestJSON(base.BaseOrchestrationTest): |
Bartosz Górski | ab33b7e | 2013-06-27 00:39:47 -0700 | [diff] [blame] | 19 | template = """ |
| 20 | HeatTemplateFormatVersion: '2012-12-12' |
| 21 | Description: | |
| 22 | Template which creates only a new user |
| 23 | Resources: |
| 24 | CfnUser: |
| 25 | Type: AWS::IAM::User |
| 26 | """ |
| 27 | |
Bartosz Górski | ab33b7e | 2013-06-27 00:39:47 -0700 | [diff] [blame] | 28 | @classmethod |
Andrea Frittoli | 556f796 | 2014-09-15 13:14:54 +0100 | [diff] [blame] | 29 | def resource_setup(cls): |
| 30 | super(TemplateYAMLTestJSON, cls).resource_setup() |
Masayuki Igawa | 259c113 | 2013-10-31 17:48:44 +0900 | [diff] [blame] | 31 | cls.stack_name = data_utils.rand_name('heat') |
Bartosz Górski | ab33b7e | 2013-06-27 00:39:47 -0700 | [diff] [blame] | 32 | cls.stack_identifier = cls.create_stack(cls.stack_name, cls.template) |
| 33 | cls.client.wait_for_stack_status(cls.stack_identifier, |
| 34 | 'CREATE_COMPLETE') |
| 35 | cls.stack_id = cls.stack_identifier.split('/')[1] |
| 36 | cls.parameters = {} |
| 37 | |
Ken'ichi Ohmichi | 835a945 | 2017-01-27 18:17:07 -0800 | [diff] [blame] | 38 | @decorators.idempotent_id('47430699-c368-495e-a1db-64c26fd967d7') |
Bartosz Górski | ab33b7e | 2013-06-27 00:39:47 -0700 | [diff] [blame] | 39 | def test_show_template(self): |
| 40 | """Getting template used to create the stack.""" |
David Kranz | 8ad924b | 2015-01-16 16:50:18 -0500 | [diff] [blame] | 41 | self.client.show_template(self.stack_identifier) |
Bartosz Górski | ab33b7e | 2013-06-27 00:39:47 -0700 | [diff] [blame] | 42 | |
Ken'ichi Ohmichi | 835a945 | 2017-01-27 18:17:07 -0800 | [diff] [blame] | 43 | @decorators.idempotent_id('ed53debe-8727-46c5-ab58-eba6090ec4de') |
Bartosz Górski | ab33b7e | 2013-06-27 00:39:47 -0700 | [diff] [blame] | 44 | def test_validate_template(self): |
| 45 | """Validating template passing it content.""" |
David Kranz | 8ad924b | 2015-01-16 16:50:18 -0500 | [diff] [blame] | 46 | self.client.validate_template(self.template, |
| 47 | self.parameters) |
Bartosz Górski | ab33b7e | 2013-06-27 00:39:47 -0700 | [diff] [blame] | 48 | |
Bartosz Górski | ab33b7e | 2013-06-27 00:39:47 -0700 | [diff] [blame] | 49 | |
| 50 | class TemplateAWSTestJSON(TemplateYAMLTestJSON): |
| 51 | template = """ |
| 52 | { |
| 53 | "AWSTemplateFormatVersion" : "2010-09-09", |
| 54 | "Description" : "Template which creates only a new user", |
| 55 | "Resources" : { |
| 56 | "CfnUser" : { |
| 57 | "Type" : "AWS::IAM::User" |
| 58 | } |
| 59 | } |
| 60 | } |
| 61 | """ |