def test_failed_send(self): client = AsyncClient() data = ('{"jsonrpc":"2.0","method":"Host.getAllVmStats","params":{},' '"id":"e8a936a6-d886-4cfa-97b9-2d54209053ff"}') headers = {Headers.REPLY_TO: 'jms.topic.vdsm_responses', Headers.CONTENT_LENGTH: '103'} with self.assertRaises(StompError): with MonkeyPatchScope([(yajsonrpc, 'CALL_TIMEOUT', 0.5)]): client.send('jms.topic.vdsm_requests', data, headers)
def test_send(self): client = AsyncClient() data = ('{"jsonrpc":"2.0","method":"Host.getAllVmStats","params":{},' '"id":"e8a936a6-d886-4cfa-97b9-2d54209053ff"}') headers = {Headers.REPLY_TO: 'jms.topic.vdsm_responses', Headers.CONTENT_LENGTH: '103'} client.send('jms.topic.vdsm_requests', data, headers) req_frame = client.pop_message() self.assertEquals(req_frame.command, Command.SEND) self.assertEquals(req_frame.headers['destination'], 'jms.topic.vdsm_requests') self.assertEquals(req_frame.headers[Headers.REPLY_TO], 'jms.topic.vdsm_responses') self.assertEquals(req_frame.body, data)
def test_send(self): client = AsyncClient() data = ('{"jsonrpc":"2.0","method":"Host.getAllVmStats","params":{},' '"id":"e8a936a6-d886-4cfa-97b9-2d54209053ff"}') headers = { Headers.REPLY_TO: 'jms.topic.vdsm_responses', Headers.CONTENT_LENGTH: '103' } client.send('jms.topic.vdsm_requests', data, headers) req_frame = client.pop_message() self.assertEquals(req_frame.command, Command.SEND) self.assertEquals(req_frame.headers['destination'], 'jms.topic.vdsm_requests') self.assertEquals(req_frame.headers[Headers.REPLY_TO], 'jms.topic.vdsm_responses') self.assertEquals(req_frame.body, data)
def test_resend(self): client = AsyncClient() data = (b'{"jsonrpc":"2.0","method":"Host.getAllVmStats","params":{},' b'"id":"e8a936a6-d886-4cfa-97b9-2d54209053ff"}') headers = { Headers.REPLY_TO: 'jms.topic.vdsm_responses', Headers.CONTENT_LENGTH: '103' } with MonkeyPatchScope([(yajsonrpc, 'CALL_TIMEOUT', 0.5)]): client.send('jms.topic.vdsm_requests', data, headers) client._connected.set() req_frame = client.pop_message() self.assertEqual(req_frame.command, Command.SEND) self.assertEqual(req_frame.headers['destination'], 'jms.topic.vdsm_requests') self.assertEqual(req_frame.headers[Headers.REPLY_TO], 'jms.topic.vdsm_responses') self.assertEqual(req_frame.body, data)