moto/tests/test_ec2/test_server.py

27 lines
662 B
Python
Raw Normal View History

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