Example #1
0
    def test_requeue_without_block_rpoplpushes(self):
        redis = MagicMock()
        key = MagicMock()
        encoding = MagicMock()
        redis_list = RedisList(redis, key)

        result = redis_list.requeue(block=False, encoding=encoding)

        redis.rpoplpush.assert_called_once_with(key, key, encoding=encoding)
        self.assertEqual(result, redis.rpoplpush.return_value)
Example #2
0
    def test_requeue_with_block_default_timeout_brpoplpushes_with_default_timeout(
            self):
        redis = MagicMock()
        key = MagicMock()
        redis_list = RedisList(redis, key)

        result = redis_list.requeue(block=True)

        redis.brpoplpush.assert_called_once_with(key,
                                                 key,
                                                 timeout=0,
                                                 encoding='utf-8')
        self.assertEqual(result, redis.brpoplpush.return_value)
Example #3
0
    def test_requeue_with_block_brpoplpushes(self):
        redis = MagicMock()
        key = MagicMock()
        redis_list = RedisList(redis, key)
        timeout = MagicMock()
        encoding = MagicMock()

        result = redis_list.requeue(block=True,
                                    timeout_seconds=timeout,
                                    encoding=encoding)

        redis.brpoplpush.assert_called_once_with(key,
                                                 key,
                                                 timeout=timeout,
                                                 encoding=encoding)
        self.assertEqual(result, redis.brpoplpush.return_value)