2014-08-27 15:17:06 +00:00
|
|
|
from __future__ import unicode_literals
|
2013-03-05 13:14:43 +00:00
|
|
|
import re
|
2013-08-03 21:21:25 +00:00
|
|
|
import sure # noqa
|
2013-03-05 13:14:43 +00:00
|
|
|
|
|
|
|
import moto.server as server
|
|
|
|
|
|
|
|
'''
|
|
|
|
Test the different server responses
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
|
|
def test_ec2_server_get():
|
2013-12-29 01:15:37 +00:00
|
|
|
backend = server.create_backend_app("ec2")
|
|
|
|
test_client = backend.test_client()
|
|
|
|
|
2014-08-26 20:42:08 +00:00
|
|
|
res = test_client.get(
|
|
|
|
'/?Action=RunInstances&ImageId=ami-60a54009',
|
|
|
|
headers={"Host": "ec2.us-east-1.amazonaws.com"}
|
|
|
|
)
|
2013-03-05 13:14:43 +00:00
|
|
|
|
2017-02-24 02:37:43 +00:00
|
|
|
groups = re.search("<instanceId>(.*)</instanceId>",
|
|
|
|
res.data.decode('utf-8'))
|
2013-03-05 13:14:43 +00:00
|
|
|
instance_id = groups.groups()[0]
|
|
|
|
|
|
|
|
res = test_client.get('/?Action=DescribeInstances')
|
2014-08-26 17:25:50 +00:00
|
|
|
res.data.decode('utf-8').should.contain(instance_id)
|