moto/tests/test_sqs/test_server.py

32 lines
891 B
Python
Raw Normal View History

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
'''
2013-03-23 13:44:53 +00:00
def test_sqs_list_identities():
2013-12-29 01:15:37 +00:00
backend = server.create_backend_app("sqs")
test_client = backend.test_client()
2013-03-05 13:14:43 +00:00
res = test_client.get('/?Action=ListQueues')
res.data.should.contain("ListQueuesResponse")
res = test_client.put('/?Action=CreateQueue&QueueName=testqueue')
res = test_client.put('/?Action=CreateQueue&QueueName=otherqueue')
res = test_client.get('/?Action=ListQueues&QueueNamePrefix=other')
res.data.should_not.contain('testqueue')
2013-03-05 13:14:43 +00:00
res = test_client.put(
'/123/testqueue?MessageBody=test-message&Action=SendMessage')
res = test_client.get(
'/123/testqueue?Action=ReceiveMessage&MaxNumberOfMessages=1')
2013-03-05 13:14:43 +00:00
message = re.search("<Body>(.*?)</Body>", res.data).groups()[0]
2013-03-23 13:44:53 +00:00
message.should.equal('test-message')