Exemplo n.º 1
0
 def test_ack_writes_correct_frame(self):
     id = '12345'
     stomp = Stomp('localhost', 61613)
     stomp._checkConnected = Mock()
     stomp._write = Mock()
     stomp.ack({'cmd': 'MESSAGE', 'headers': {'message-id': id}, 'body': 'blah'})
     args,kargs = stomp._write.call_args
     sentFrame = self.parseFrame(args[0])
     self.assertEquals({'cmd': 'ACK',
                        'headers': {'message-id': id,
                                   },
                        'body': ''}, sentFrame)
Exemplo n.º 2
0
 def test_send_writes_correct_frame(self):
     dest = '/queue/foo'
     msg = 'test message'
     headers = {'foo': 'bar', 'fuzz': 'ball'}
     stomp = Stomp('localhost', 61613)
     stomp._checkConnected = Mock()
     stomp._write = Mock()
     stomp.send(dest, msg, headers)
     args,kargs = stomp._write.call_args
     sentFrame = self.parseFrame(args[0])
     self.assertEquals({'cmd': 'SEND',
                        'headers': {'destination': dest,
                                    'foo': 'bar',
                                    'fuzz': 'ball',
                                   },
                        'body': msg}, sentFrame)
Exemplo n.º 3
0
 def test_subscribe_writes_correct_frame(self):
     dest = '/queue/foo'
     headers = {'foo': 'bar', 'fuzz': 'ball'}
     stomp = Stomp('localhost', 61613)
     stomp._checkConnected = Mock()
     stomp._write = Mock()
     stomp.subscribe(dest, headers)
     args,kargs = stomp._write.call_args
     sentFrame = self.parseFrame(args[0])
     self.assertEquals({'cmd': 'SUBSCRIBE',
                        'headers': {'destination': dest,
                                    'ack': 'auto',
                                    'activemq.prefetchSize': '1',
                                    'foo': 'bar',
                                    'fuzz': 'ball',
                                   },
                        'body': ''}, sentFrame)