2014-08-27 11:17:06 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								from  __future__  import  unicode_literals 
							 
						 
					
						
							
								
									
										
										
										
											2014-03-27 19:12:53 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								import  json 
							 
						 
					
						
							
								
									
										
										
										
											2017-05-01 11:28:35 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								import  yaml 
							 
						 
					
						
							
								
									
										
										
										
											2014-03-27 19:12:53 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								from  mock  import  patch 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								import  sure   # noqa 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-02-23 22:28:09 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								from  moto . cloudformation . exceptions  import  ValidationError 
							 
						 
					
						
							
								
									
										
										
										
											2014-03-27 19:12:53 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								from  moto . cloudformation . models  import  FakeStack 
							 
						 
					
						
							
								
									
										
										
										
											2015-01-07 21:37:12 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								from  moto . cloudformation . parsing  import  resource_class_from_type ,  parse_condition 
							 
						 
					
						
							
								
									
										
										
										
											2014-03-27 19:12:53 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								from  moto . sqs . models  import  Queue 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-15 11:28:07 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								from  moto . s3 . models  import  FakeBucket 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-21 12:45:03 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								from  boto . cloudformation . stack  import  Output 
							 
						 
					
						
							
								
									
										
										
										
											2014-03-27 19:12:53 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								dummy_template  =  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    " AWSTemplateFormatVersion " :  " 2010-09-09 " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    " Description " :  " Create a multi-az, load balanced, Auto Scaled sample web site. The Auto Scaling trigger is based on the CPU utilization of the web servers. The AMI is chosen based on the region in which the stack is run. This example creates a web service running across all availability zones in a region. The instances are load balanced with a simple health check. The web site is available on port 80, however, the instances can be configured to listen on any port (8888 by default). **WARNING** This template creates one or more Amazon EC2 instances. You will be billed for the AWS resources used if you create a stack from this template. " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    " Resources " :  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-21 12:45:03 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        " Queue " :  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-03-27 19:12:53 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            " Type " :  " AWS::SQS::Queue " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            " Properties " :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                " QueueName " :  " my-queue " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                " VisibilityTimeout " :  60 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } , 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-15 11:28:07 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        " S3Bucket " :  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-23 21:37:43 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            " Type " :  " AWS::S3::Bucket " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            " DeletionPolicy " :  " Retain " 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-15 11:28:07 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        } , 
							 
						 
					
						
							
								
									
										
										
										
											2014-03-27 19:12:53 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-10-20 11:45:47 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								name_type_template  =  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    " AWSTemplateFormatVersion " :  " 2010-09-09 " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    " Description " :  " Create a multi-az, load balanced, Auto Scaled sample web site. The Auto Scaling trigger is based on the CPU utilization of the web servers. The AMI is chosen based on the region in which the stack is run. This example creates a web service running across all availability zones in a region. The instances are load balanced with a simple health check. The web site is available on port 80, however, the instances can be configured to listen on any port (8888 by default). **WARNING** This template creates one or more Amazon EC2 instances. You will be billed for the AWS resources used if you create a stack from this template. " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    " Resources " :  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-21 12:45:03 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        " Queue " :  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-20 11:45:47 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            " Type " :  " AWS::SQS::Queue " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            " Properties " :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                " VisibilityTimeout " :  60 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-10-21 12:45:03 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								output_dict  =  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    " Outputs " :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " Output1 " :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            " Value " :  { " Ref " :  " Queue " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            " Description " :  " This is a description. " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								bad_output  =  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    " Outputs " :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " Output1 " :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            " Value " :  { " Fn::GetAtt " :  [ " Queue " ,  " InvalidAttribute " ] } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								get_attribute_output  =  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    " Outputs " :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " Output1 " :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            " Value " :  { " Fn::GetAtt " :  [ " Queue " ,  " QueueName " ] } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-02-23 21:37:43 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								outputs_template  =  dict ( list ( dummy_template . items ( ) )  + 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                        list ( output_dict . items ( ) ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								bad_outputs_template  =  dict ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    list ( dummy_template . items ( ) )  +  list ( bad_output . items ( ) ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								get_attribute_outputs_template  =  dict ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    list ( dummy_template . items ( ) )  +  list ( get_attribute_output . items ( ) ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-21 12:45:03 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-03-27 19:12:53 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								dummy_template_json  =  json . dumps ( dummy_template ) 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-20 11:45:47 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								name_type_template_json  =  json . dumps ( name_type_template ) 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-21 12:45:03 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								output_type_template_json  =  json . dumps ( outputs_template ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								bad_output_template_json  =  json . dumps ( bad_outputs_template ) 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-23 21:37:43 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								get_attribute_outputs_template_json  =  json . dumps ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    get_attribute_outputs_template ) 
							 
						 
					
						
							
								
									
										
										
										
											2014-03-27 19:12:53 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								def  test_parse_stack_resources ( ) : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    stack  =  FakeStack ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        stack_id = " test_id " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        name = " test_stack " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        template = dummy_template_json , 
							 
						 
					
						
							
								
									
										
										
										
											2014-12-31 14:21:47 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        parameters = { } , 
							 
						 
					
						
							
								
									
										
										
										
											2014-11-15 13:34:52 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        region_name = ' us-west-1 ' ) 
							 
						 
					
						
							
								
									
										
										
										
											2014-03-27 19:12:53 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-08-15 11:28:07 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    stack . resource_map . should . have . length_of ( 2 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-08-15 12:36:39 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    queue  =  stack . resource_map [ ' Queue ' ] 
							 
						 
					
						
							
								
									
										
										
										
											2014-03-27 19:12:53 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    queue . should . be . a ( Queue ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    queue . name . should . equal ( " my-queue " ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-08-15 12:36:39 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    bucket  =  stack . resource_map [ ' S3Bucket ' ] 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-15 11:28:07 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    bucket . should . be . a ( FakeBucket ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    bucket . physical_resource_id . should . equal ( bucket . name ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-03-27 19:12:53 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								@patch ( " moto.cloudformation.parsing.logger " ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								def  test_missing_resource_logs ( logger ) : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    resource_class_from_type ( " foobar " ) 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-23 21:37:43 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    logger . warning . assert_called_with ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        ' No Moto CloudFormation support for  %s ' ,  ' foobar ' ) 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-20 11:45:47 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								def  test_parse_stack_with_name_type_resource ( ) : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    stack  =  FakeStack ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        stack_id = " test_id " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        name = " test_stack " , 
							 
						 
					
						
							
								
									
										
										
										
											2014-11-15 13:34:52 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        template = name_type_template_json , 
							 
						 
					
						
							
								
									
										
										
										
											2014-12-31 14:21:47 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        parameters = { } , 
							 
						 
					
						
							
								
									
										
										
										
											2014-11-15 13:34:52 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        region_name = ' us-west-1 ' ) 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-20 11:45:47 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    stack . resource_map . should . have . length_of ( 1 ) 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-21 12:45:03 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    list ( stack . resource_map . keys ( ) ) [ 0 ] . should . equal ( ' Queue ' ) 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-20 11:45:47 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    queue  =  list ( stack . resource_map . values ( ) ) [ 0 ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    queue . should . be . a ( Queue ) 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-21 12:45:03 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-05-01 11:28:35 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								def  test_parse_stack_with_yaml_template ( ) : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    stack  =  FakeStack ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        stack_id = " test_id " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        name = " test_stack " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        template = yaml . dump ( name_type_template ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        parameters = { } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        region_name = ' us-west-1 ' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    stack . resource_map . should . have . length_of ( 1 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    list ( stack . resource_map . keys ( ) ) [ 0 ] . should . equal ( ' Queue ' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    queue  =  list ( stack . resource_map . values ( ) ) [ 0 ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    queue . should . be . a ( Queue ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-10-21 12:45:03 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								def  test_parse_stack_with_outputs ( ) : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    stack  =  FakeStack ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        stack_id = " test_id " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        name = " test_stack " , 
							 
						 
					
						
							
								
									
										
										
										
											2014-11-15 13:34:52 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        template = output_type_template_json , 
							 
						 
					
						
							
								
									
										
										
										
											2014-12-31 14:21:47 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        parameters = { } , 
							 
						 
					
						
							
								
									
										
										
										
											2014-11-15 13:34:52 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        region_name = ' us-west-1 ' ) 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-21 12:45:03 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    stack . output_map . should . have . length_of ( 1 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    list ( stack . output_map . keys ( ) ) [ 0 ] . should . equal ( ' Output1 ' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    output  =  list ( stack . output_map . values ( ) ) [ 0 ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    output . should . be . a ( Output ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    output . description . should . equal ( " This is a description. " ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								def  test_parse_stack_with_get_attribute_outputs ( ) : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    stack  =  FakeStack ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        stack_id = " test_id " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        name = " test_stack " , 
							 
						 
					
						
							
								
									
										
										
										
											2014-11-15 13:34:52 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        template = get_attribute_outputs_template_json , 
							 
						 
					
						
							
								
									
										
										
										
											2014-12-31 14:21:47 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        parameters = { } , 
							 
						 
					
						
							
								
									
										
										
										
											2014-11-15 13:34:52 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        region_name = ' us-west-1 ' ) 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-21 12:45:03 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    stack . output_map . should . have . length_of ( 1 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    list ( stack . output_map . keys ( ) ) [ 0 ] . should . equal ( ' Output1 ' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    output  =  list ( stack . output_map . values ( ) ) [ 0 ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    output . should . be . a ( Output ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    output . value . should . equal ( " my-queue " ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								def  test_parse_stack_with_bad_get_attribute_outputs ( ) : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    FakeStack . when . called_with ( 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-23 22:28:09 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        " test_id " ,  " test_stack " ,  bad_output_template_json ,  { } ,  " us-west-1 " ) . should . throw ( ValidationError ) 
							 
						 
					
						
							
								
									
										
										
										
											2015-01-07 21:37:12 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								def  test_parse_equals_condition ( ) : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    parse_condition ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        condition = { " Fn::Equals " :  [ { " Ref " :  " EnvType " } ,  " prod " ] } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        resources_map = { " EnvType " :  " prod " } , 
							 
						 
					
						
							
								
									
										
										
										
											2015-01-11 16:15:08 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        condition_map = { } , 
							 
						 
					
						
							
								
									
										
										
										
											2015-01-07 21:37:12 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    ) . should . equal ( True ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    parse_condition ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        condition = { " Fn::Equals " :  [ { " Ref " :  " EnvType " } ,  " prod " ] } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        resources_map = { " EnvType " :  " staging " } , 
							 
						 
					
						
							
								
									
										
										
										
											2015-01-11 16:15:08 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        condition_map = { } , 
							 
						 
					
						
							
								
									
										
										
										
											2015-01-07 21:37:12 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    ) . should . equal ( False ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								def  test_parse_not_condition ( ) : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    parse_condition ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        condition = { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            " Fn::Not " :  [ { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                " Fn::Equals " :  [ { " Ref " :  " EnvType " } ,  " prod " ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            } ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        resources_map = { " EnvType " :  " prod " } , 
							 
						 
					
						
							
								
									
										
										
										
											2015-01-11 16:15:08 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        condition_map = { } , 
							 
						 
					
						
							
								
									
										
										
										
											2015-01-07 21:37:12 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    ) . should . equal ( False ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    parse_condition ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        condition = { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            " Fn::Not " :  [ { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                " Fn::Equals " :  [ { " Ref " :  " EnvType " } ,  " prod " ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            } ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        resources_map = { " EnvType " :  " staging " } , 
							 
						 
					
						
							
								
									
										
										
										
											2015-01-11 16:15:08 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        condition_map = { } , 
							 
						 
					
						
							
								
									
										
										
										
											2015-01-07 21:37:12 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    ) . should . equal ( True ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								def  test_parse_and_condition ( ) : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    parse_condition ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        condition = { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            " Fn::And " :  [ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                { " Fn::Equals " :  [ { " Ref " :  " EnvType " } ,  " prod " ] } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                { " Fn::Equals " :  [ { " Ref " :  " EnvType " } ,  " staging " ] } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        resources_map = { " EnvType " :  " prod " } , 
							 
						 
					
						
							
								
									
										
										
										
											2015-01-11 16:15:08 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        condition_map = { } , 
							 
						 
					
						
							
								
									
										
										
										
											2015-01-07 21:37:12 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    ) . should . equal ( False ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    parse_condition ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        condition = { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            " Fn::And " :  [ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                { " Fn::Equals " :  [ { " Ref " :  " EnvType " } ,  " prod " ] } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                { " Fn::Equals " :  [ { " Ref " :  " EnvType " } ,  " prod " ] } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        resources_map = { " EnvType " :  " prod " } , 
							 
						 
					
						
							
								
									
										
										
										
											2015-01-11 16:15:08 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        condition_map = { } , 
							 
						 
					
						
							
								
									
										
										
										
											2015-01-07 21:37:12 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    ) . should . equal ( True ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								def  test_parse_or_condition ( ) : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    parse_condition ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        condition = { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            " Fn::Or " :  [ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                { " Fn::Equals " :  [ { " Ref " :  " EnvType " } ,  " prod " ] } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                { " Fn::Equals " :  [ { " Ref " :  " EnvType " } ,  " staging " ] } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        resources_map = { " EnvType " :  " prod " } , 
							 
						 
					
						
							
								
									
										
										
										
											2015-01-11 16:15:08 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        condition_map = { } , 
							 
						 
					
						
							
								
									
										
										
										
											2015-01-07 21:37:12 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    ) . should . equal ( True ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    parse_condition ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        condition = { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            " Fn::Or " :  [ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                { " Fn::Equals " :  [ { " Ref " :  " EnvType " } ,  " staging " ] } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                { " Fn::Equals " :  [ { " Ref " :  " EnvType " } ,  " staging " ] } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        resources_map = { " EnvType " :  " prod " } , 
							 
						 
					
						
							
								
									
										
										
										
											2015-01-11 16:15:08 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        condition_map = { } , 
							 
						 
					
						
							
								
									
										
										
										
											2015-01-07 21:37:12 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    ) . should . equal ( False ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								def  test_reference_other_conditions ( ) : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    parse_condition ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        condition = { " Fn::Not " :  [ { " Condition " :  " OtherCondition " } ] } , 
							 
						 
					
						
							
								
									
										
										
										
											2015-01-11 16:15:08 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        resources_map = { } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        condition_map = { " OtherCondition " :  True } , 
							 
						 
					
						
							
								
									
										
										
										
											2015-01-07 21:37:12 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    ) . should . equal ( False )