Enabled cloudformation in server mode with some tests
This commit is contained in:
parent
9c81b7340c
commit
b2570d901e
@ -1,6 +1,7 @@
|
||||
from __future__ import unicode_literals
|
||||
from moto.autoscaling import autoscaling_backend
|
||||
from moto.cloudwatch import cloudwatch_backend
|
||||
from moto.cloudformation import cloudformation_backend
|
||||
from moto.dynamodb import dynamodb_backend
|
||||
from moto.dynamodb2 import dynamodb_backend2
|
||||
from moto.ec2 import ec2_backend
|
||||
@ -20,6 +21,7 @@ from moto.route53 import route53_backend
|
||||
|
||||
BACKENDS = {
|
||||
'autoscaling': autoscaling_backend,
|
||||
'cloudformation': cloudformation_backend,
|
||||
'cloudwatch': cloudwatch_backend,
|
||||
'dynamodb': dynamodb_backend,
|
||||
'dynamodb2': dynamodb_backend2,
|
||||
|
@ -161,7 +161,7 @@ LIST_STACKS_RESPONSE = """<ListStacksResponse>
|
||||
<StackSummaries>
|
||||
{% for stack in stacks %}
|
||||
<member>
|
||||
<StackId>{{ stack.id }}</StackId>
|
||||
<StackId>{{ stack.stack_id }}</StackId>
|
||||
<StackStatus>{{ stack.status }}</StackStatus>
|
||||
<StackName>{{ stack.name }}</StackName>
|
||||
<CreationTime>2011-05-23T15:47:44Z</CreationTime>
|
||||
|
@ -1 +1,39 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import json
|
||||
import urllib
|
||||
import re
|
||||
import sure # noqa
|
||||
|
||||
import moto.server as server
|
||||
|
||||
'''
|
||||
Test the different server responses
|
||||
'''
|
||||
|
||||
def test_cloudformation_server_get():
|
||||
backend = server.create_backend_app("cloudformation")
|
||||
stack_name = 'test stack'
|
||||
test_client = backend.test_client()
|
||||
template_body = {
|
||||
"Resources": {},
|
||||
}
|
||||
res = test_client.get(
|
||||
'/?{0}'.format(
|
||||
urllib.urlencode({
|
||||
"Action": "CreateStack",
|
||||
"StackName": stack_name,
|
||||
"TemplateBody": json.dumps(template_body)
|
||||
})),
|
||||
headers={"Host":"cloudformation.us-east-1.amazonaws.com"}
|
||||
)
|
||||
stack_id = json.loads(res.data)["CreateStackResponse"]["CreateStackResult"]["StackId"]
|
||||
|
||||
res = test_client.get(
|
||||
'/?Action=ListStacks',
|
||||
headers={"Host":"cloudformation.us-east-1.amazonaws.com"}
|
||||
)
|
||||
stacks = re.search("<StackId>(.*)</StackId>", res.data.decode('utf-8'))
|
||||
|
||||
list_stack_id = stacks.groups()[0]
|
||||
assert stack_id == list_stack_id
|
||||
|
Loading…
Reference in New Issue
Block a user