Added iam backend to servers, added some tests to check backend
This commit is contained in:
parent
71d2e1d7de
commit
42b95023f5
4 changed files with 37 additions and 21 deletions
|
|
@ -15,27 +15,17 @@ 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()
|
||||
test_client = backend.test_client(service="cloudformation")
|
||||
template_body = {
|
||||
"Resources": {},
|
||||
}
|
||||
res = test_client.get(
|
||||
'/?{0}'.format(
|
||||
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.decode("utf-8"))["CreateStackResponse"]["CreateStackResult"]["StackId"]
|
||||
res = test_client.action_json("CreateStack", StackName=stack_name,
|
||||
TemplateBody=json.dumps(template_body))
|
||||
stack_id = res["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'))
|
||||
data = test_client.action_data("ListStacks")
|
||||
|
||||
stacks = re.search("<StackId>(.*)</StackId>", data)
|
||||
|
||||
list_stack_id = stacks.groups()[0]
|
||||
assert stack_id == list_stack_id
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue