moto/tests/test_sqs/test_server.py
Clint Ecker c18e0cc82e Enhanced SQS support
- Support for delaying messages
- Support for visibility timeouts
- Support for actually deleting messages
- Support for message bodies longer than 27 characters
- Support for message attributes
- Support for accurate queue attributes

Caveats:

- All message attributes are returned regardless of whether or not
attributes were requested when reading messages
- I’m not sure why messages longer than 27 characters were breaking in
my tests. Boto seems to expect the body to be base64 encoded and bodies
less than 27 characters would be fine, but if I attempted to use a
larger body it would mangle the content. I now base64 encode the body
if the raw string is longer than 27 characters and all is fine.
2014-06-20 15:00:36 -05:00

32 lines
891 B
Python

import re
import sure # noqa
import moto.server as server
'''
Test the different server responses
'''
def test_sqs_list_identities():
backend = server.create_backend_app("sqs")
test_client = backend.test_client()
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')
res = test_client.put(
'/123/testqueue?MessageBody=test-message&Action=SendMessage')
res = test_client.get(
'/123/testqueue?Action=ReceiveMessage&MaxNumberOfMessages=1')
message = re.search("<Body>(.*?)</Body>", res.data).groups()[0]
message.should.equal('test-message')