add support to rpc for multicall

This commit is contained in:
termie
2011-05-25 15:42:24 -07:00
parent 8b896f5925
commit 1f23c30868
2 changed files with 90 additions and 26 deletions

View File

@@ -49,6 +49,17 @@ class RpcTestCase(test.TestCase):
"args": {"value": value}})
self.assertEqual(value, result)
def test_multicall_succeed_three_times(self):
"""Get a value through rpc call"""
value = 42
result = rpc.multicall(self.context,
'test',
{"method": "echo_three_times",
"args": {"value": value}})
for x in result:
self.assertEqual(value, x)
def test_context_passed(self):
"""Makes sure a context is passed through rpc call"""
value = 42
@@ -126,6 +137,12 @@ class TestReceiver(object):
LOG.debug(_("Received %s"), context)
return context.to_dict()
@staticmethod
def echo_three_times(context, value):
context.reply(value)
context.reply(value)
context.reply(value)
@staticmethod
def fail(context, value):
"""Raises an exception with the value sent in"""