'Test declare_queue, where an exception is raised and silenced.'

@patch(u'amqp.protocol.queue_declare_ok_t')
def test_queue_declare_with_exception_raised(self, mock_queue_declare_ok_t):

    mock_queue = Mock()
    mock_passive = Mock()
    mock_durable = Mock()
    mock_exclusive = Mock()
    mock_auto_delete = Mock()
    mock_nowait = Mock()
    mock_arguments = Mock()
    mock_msg_count = Mock()
    mock_queue.startswith.return_value = False
    mock_queue.endswith.return_value = False
    options = {u'passive': mock_passive, u'durable': mock_durable, u'exclusive': mock_exclusive, u'auto-delete': mock_auto_delete, u'arguments': mock_arguments}
    mock_consumer_count = Mock()
    mock_return_value = Mock()
    values_dict = {u'msgDepth': mock_msg_count, u'consumerCount': mock_consumer_count}
    mock_queue_data = Mock()
    mock_queue_data.values = values_dict
    exception_to_raise = Exception(u'The    foo    object    already    exists.')
    self.mock_broker.addQueue.side_effect = exception_to_raise
    self.mock_broker.getQueue.return_value = mock_queue_data
    mock_queue_declare_ok_t.return_value = mock_return_value
    result = self.my_channel.queue_declare(mock_queue, passive=mock_passive, durable=mock_durable, exclusive=mock_exclusive, auto_delete=mock_auto_delete, nowait=mock_nowait, arguments=mock_arguments)
    self.mock_broker.addQueue.assert_called_with(mock_queue, options=options)
    mock_queue_declare_ok_t.assert_called_with(mock_queue, mock_msg_count, mock_consumer_count)
    assert (mock_return_value is result)
