| 
									
										
										
										
											2014-08-27 11:17:06 -04:00
										 |  |  | from __future__ import unicode_literals | 
					
						
							| 
									
										
										
										
											2015-08-02 16:27:08 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | import json | 
					
						
							| 
									
										
										
										
											2015-08-02 11:37:10 -04:00
										 |  |  | from six.moves.urllib.parse import urlencode | 
					
						
							| 
									
										
										
										
											2015-08-02 16:27:08 +02:00
										 |  |  | import re | 
					
						
							| 
									
										
										
										
											2015-08-02 11:37:10 -04:00
										 |  |  | import sure  # noqa | 
					
						
							| 
									
										
										
										
											2015-08-02 16:27:08 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | import moto.server as server | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | '''
 | 
					
						
							|  |  |  | Test the different server responses | 
					
						
							|  |  |  | '''
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-02 11:37:10 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-02 16:27:08 +02:00
										 |  |  | def test_cloudformation_server_get(): | 
					
						
							|  |  |  |     backend = server.create_backend_app("cloudformation") | 
					
						
							|  |  |  |     stack_name = 'test stack' | 
					
						
							| 
									
										
										
										
											2015-08-03 00:31:36 +02:00
										 |  |  |     test_client = backend.test_client(service="cloudformation") | 
					
						
							| 
									
										
										
										
											2015-08-02 16:27:08 +02:00
										 |  |  |     template_body = { | 
					
						
							|  |  |  |         "Resources": {}, | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2015-08-03 00:31:36 +02:00
										 |  |  |     res = test_client.action_json("CreateStack", StackName=stack_name, | 
					
						
							|  |  |  |         TemplateBody=json.dumps(template_body)) | 
					
						
							|  |  |  |     stack_id = res["CreateStackResponse"]["CreateStackResult"]["StackId"] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     data = test_client.action_data("ListStacks") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     stacks = re.search("<StackId>(.*)</StackId>", data) | 
					
						
							| 
									
										
										
										
											2015-08-02 16:27:08 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     list_stack_id = stacks.groups()[0] | 
					
						
							|  |  |  |     assert stack_id == list_stack_id |