Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_message_update_property_without_decode(self):
message = Message.create(None, '', None)
message._auto_decode = False
message._update_properties('app_id', '123')
self.assertEqual(message.properties['app_id'], '123')
self.assertEqual(message._properties['app_id'], '123')
def test_message_delivery_mode_two(self):
delivery_mode = 2
message = Message.create(None, '')
message.delivery_mode = delivery_mode
self.assertEqual(delivery_mode, message.delivery_mode)
def test_message_priority_three(self):
priority = 3
message = Message.create(None, '')
message.priority = priority
self.assertEqual(priority, message.priority)
def test_message_reject_raises_on_outbound(self):
message = Message.create(body='',
channel=None)
self.assertRaises(AMQPMessageError, message.reject)
def setUp(self):
self.connection = Connection(HOST, USERNAME, PASSWORD)
self.channel = self.connection.channel()
self.channel.queue.declare('test.basic.resend')
self.channel.queue.purge('test.basic.resend')
self.channel.confirm_deliveries()
message = Message.create(self.channel,
body=str(uuid.uuid4()))
message.app_id = 'travis-ci'
message.publish('test.basic.resend')
def on_request(message):
number = int(message.body)
print(" [.] fib(%s)" % (number,))
response = str(fib(number))
properties = {
'correlation_id': message.correlation_id
}
response = Message.create(message.channel, response, properties)
response.publish(message.reply_to)
message.ack()
def on_request(message):
number = int(message.body)
print(" [.] fib(%s)" % (number,))
response = str(fib(number))
properties = {
'correlation_id': message.correlation_id
}
response = Message.create(message.channel, response, properties)
response.publish(message.reply_to)
message.ack()
def call(self, number):
self.response = None
message = Message.create(self.channel, body=str(number))
message.reply_to = self.callback_queue
self.correlation_id = message.correlation_id
message.publish(routing_key='rpc_queue')
while not self.response:
self.channel.process_data_events(to_tuple=False)
return int(self.response)