'Mock the back-end SQS classes'

def setup(self):

    SQS.Channel._queue_cache.clear()
    self.queue_name = u'unittest'
    self.sqs_conn_mock = SQSClientMock()
    def mock_sqs():
        return self.sqs_conn_mock
    SQS.Channel.sqs = mock_sqs()
    self.exchange = Exchange(u'test_SQS', type=u'direct')
    self.queue = Queue(self.queue_name, self.exchange, self.queue_name)
    self.sqs_queue_mock = QueueMock((u'sqs://' + self.queue_name))
    self.connection = Connection(transport=SQS.Transport)
    self.channel = self.connection.channel()
    self.queue(self.channel).declare()
    self.producer = messaging.Producer(self.channel, self.exchange, routing_key=self.queue_name)
    self.channel.basic_consume(self.queue_name, no_ack=False, callback=self.handleMessageCallback, consumer_tag=u'unittest')
