本文整理汇总了Python中pyon.net.transport.AMQPTransport.delete_exchange_impl方法的典型用法代码示例。如果您正苦于以下问题:Python AMQPTransport.delete_exchange_impl方法的具体用法?Python AMQPTransport.delete_exchange_impl怎么用?Python AMQPTransport.delete_exchange_impl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyon.net.transport.AMQPTransport
的用法示例。
在下文中一共展示了AMQPTransport.delete_exchange_impl方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestAMQPTransportCommonMethods
# 需要导入模块: from pyon.net.transport import AMQPTransport [as 别名]
# 或者: from pyon.net.transport.AMQPTransport import delete_exchange_impl [as 别名]
class TestAMQPTransportCommonMethods(PyonTestCase):
def setUp(self):
self.tp = AMQPTransport(MagicMock())
self.tp._sync_call = Mock()
def test_declare_exchange_impl(self):
self.tp.declare_exchange_impl(sentinel.exchange)
self.tp._sync_call.assert_called_once_with(self.tp._client.exchange_declare,
'callback',
exchange=sentinel.exchange,
type='topic',
durable=False,
auto_delete=True,
arguments={})
@patch('pyon.net.transport.os', new_callable=MagicMock)
def test_declare_exchange_impl_queue_blame(self, osmock):
osmock.environ.get.return_value = True
osmock.environ.__getitem__.return_value = sentinel.testid
self.tp.declare_exchange_impl(sentinel.exchange)
self.tp._sync_call.assert_called_once_with(self.tp._client.exchange_declare,
'callback',
exchange=sentinel.exchange,
type='topic',
durable=False,
auto_delete=True,
arguments={'created-by':sentinel.testid})
def test_delete_exchange_impl(self):
self.tp.delete_exchange_impl(sentinel.exchange)
self.tp._sync_call.assert_called_once_with(self.tp._client.exchange_delete,
'callback',
exchange=sentinel.exchange)
def test_declare_queue_impl(self):
retqueue = self.tp.declare_queue_impl(sentinel.queue)
self.tp._sync_call.assert_called_once_with(self.tp._client.queue_declare,
'callback',
queue=sentinel.queue,
auto_delete=True,
durable=False,
arguments={})
self.assertEquals(retqueue, self.tp._sync_call.return_value.method.queue)
@patch('pyon.net.transport.os', new_callable=MagicMock)
def test_declare_queue_impl_queue_blame(self, osmock):
osmock.environ.get.return_value = True
osmock.environ.__getitem__.return_value = sentinel.testid
retqueue = self.tp.declare_queue_impl(sentinel.queue)
self.tp._sync_call.assert_called_once_with(self.tp._client.queue_declare,
'callback',
queue=sentinel.queue,
durable=False,
auto_delete=True,
arguments={'created-by':sentinel.testid})
self.assertEquals(retqueue, self.tp._sync_call.return_value.method.queue)
def test_delete_queue(self):
self.tp.delete_queue_impl(sentinel.queue)
self.tp._sync_call.assert_called_once_with(self.tp._client.queue_delete,
'callback',
queue=sentinel.queue)
def test_bind_impl(self):
self.tp.bind_impl(sentinel.exchange, sentinel.queue, sentinel.binding)
self.tp._sync_call.assert_called_once_with(self.tp._client.queue_bind,
'callback',
queue=sentinel.queue,
exchange=sentinel.exchange,
routing_key=sentinel.binding)
def test_unbind_impl(self):
self.tp.unbind_impl(sentinel.exchange, sentinel.queue, sentinel.binding)
self.tp._sync_call.assert_called_once_with(self.tp._client.queue_unbind,
'callback',
queue=sentinel.queue,
exchange=sentinel.exchange,
routing_key=sentinel.binding)
def test_ack_impl(self):
self.tp.ack_impl(sentinel.dtag)
self.tp._client.basic_ack.assert_called_once_with(sentinel.dtag)
def test_reject_impl(self):
self.tp.reject_impl(sentinel.dtag)
self.tp._client.basic_reject.assert_called_once_with(sentinel.dtag, requeue=False)
#.........这里部分代码省略.........