2014-08-27 15:17:06 +00:00
|
|
|
from __future__ import unicode_literals
|
2015-08-02 14:27:08 +00:00
|
|
|
|
|
|
|
import json
|
2015-08-02 15:37:10 +00:00
|
|
|
from six.moves.urllib.parse import urlencode
|
2015-08-02 14:27:08 +00:00
|
|
|
import re
|
2015-08-02 15:37:10 +00:00
|
|
|
import sure # noqa
|
2015-08-02 14:27:08 +00:00
|
|
|
|
|
|
|
import moto.server as server
|
|
|
|
|
|
|
|
'''
|
|
|
|
Test the different server responses
|
|
|
|
'''
|
|
|
|
|
2015-08-02 15:37:10 +00:00
|
|
|
|
2015-08-02 14:27:08 +00:00
|
|
|
def test_cloudformation_server_get():
|
|
|
|
backend = server.create_backend_app("cloudformation")
|
|
|
|
stack_name = 'test stack'
|
2015-08-02 22:31:36 +00:00
|
|
|
test_client = backend.test_client(service="cloudformation")
|
2015-08-02 14:27:08 +00:00
|
|
|
template_body = {
|
|
|
|
"Resources": {},
|
|
|
|
}
|
2015-08-02 22:31:36 +00: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 14:27:08 +00:00
|
|
|
|
|
|
|
list_stack_id = stacks.groups()[0]
|
|
|
|
assert stack_id == list_stack_id
|