Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async def test_exclusive_queue_locked(amqp_connection):
channel0 = await amqp_connection.channel()
channel1 = await amqp_connection.channel()
qname = str(uuid.uuid4())
await channel0.queue_declare(qname, exclusive=True)
try:
await channel0.basic_consume(qname, print, exclusive=True)
with pytest.raises(aiormq.exceptions.ChannelLockedResource):
await channel1.queue_declare(qname)
await channel1.basic_consume(qname, print, exclusive=True)
finally:
await channel0.queue_delete(qname)
def __exception_by_code(frame: spec.Channel.Close): # pragma: nocover
if frame.reply_code == 403:
return exc.ChannelAccessRefused(frame.reply_text)
elif frame.reply_code == 404:
return exc.ChannelNotFoundEntity(frame.reply_text)
elif frame.reply_code == 405:
return exc.ChannelLockedResource(frame.reply_text)
elif frame.reply_code == 406:
return exc.ChannelPreconditionFailed(frame.reply_text)
else:
return exc.ChannelClosed(frame.reply_code, frame.reply_text)