moto/tests/test_cloudformation/test_server.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

31 lines
874 B
Python
Raw Normal View History

import json
import re
import moto.server as server
2019-10-31 15:44:26 +00:00
"""
Test the different server responses
2019-10-31 15:44:26 +00:00
"""
def test_cloudformation_server_get():
backend = server.create_backend_app("cloudformation")
stack_name = "test stack"
test_client = backend.test_client()
template_body = {"Resources": {}}
create_stack_resp = test_client.action_data(
2017-02-24 02:37:43 +00:00
"CreateStack", StackName=stack_name, TemplateBody=json.dumps(template_body)
2019-10-31 15:44:26 +00:00
)
assert "<CreateStackResponse>" in create_stack_resp
assert "<StackId>" in create_stack_resp
stack_id_from_create = re.search(
2017-02-24 02:37:43 +00:00
"<StackId>(.*)</StackId>", create_stack_resp
).groups()[0]
list_stacks_resp = test_client.action_data("ListStacks")
stack_id_from_list = re.search(
2017-02-24 02:37:43 +00:00
"<StackId>(.*)</StackId>", list_stacks_resp
).groups()[0]
assert stack_id_from_create == stack_id_from_list