Merge "Adds encapsulation control to the client"
This commit is contained in:
commit
2acbced0ea
@ -98,8 +98,25 @@ class TestV1Core(base.TestBase):
|
||||
result = core.queue_get_stats(self.transport, req, 'test')
|
||||
self.assertEqual(result, {})
|
||||
|
||||
def test_message_post(self):
|
||||
messages = [{'ttl': 30, 'body': 'Post It!'}]
|
||||
def test_message_post_one(self):
|
||||
messages = {'ttl': 30, 'body': 'Post one!'}
|
||||
|
||||
with mock.patch.object(self.transport, 'send',
|
||||
autospec=True) as send_method:
|
||||
resp = response.Response(None, '{}')
|
||||
send_method.return_value = resp
|
||||
|
||||
req = request.Request()
|
||||
|
||||
core.message_post(self.transport, req, 'test', messages)
|
||||
self.assertIn('queue_name', req.params)
|
||||
self.assertEqual(json.loads(req.content),
|
||||
messages)
|
||||
|
||||
def test_message_post_many(self):
|
||||
messages = [{'ttl': 30, 'body': 'Post one!'},
|
||||
{'ttl': 30, 'body': 'Post two!'},
|
||||
{'ttl': 30, 'body': 'Post three!'}, ]
|
||||
|
||||
with mock.patch.object(self.transport, 'send',
|
||||
autospec=True) as send_method:
|
||||
|
@ -108,6 +108,9 @@ class Queue(object):
|
||||
if not isinstance(messages, list):
|
||||
messages = [messages]
|
||||
|
||||
if self.client.api_version >= 1.1:
|
||||
messages = {'messages': messages}
|
||||
|
||||
req, trans = self.client._request_and_transport()
|
||||
|
||||
# TODO(flaper87): Return a list of messages
|
||||
|
Loading…
Reference in New Issue
Block a user