Ejemplo n.º 1
0
    def test_move_with_block_default_timeout_brpoplpushes_with_default_timeout(
            self):
        redis = MagicMock()
        key = MagicMock()
        redis_list = RedisList(redis, key)
        destination_key = MagicMock()

        result = redis_list.move(destination_key, block=True)

        redis.brpoplpush.assert_called_once_with(key,
                                                 destination_key,
                                                 timeout=0,
                                                 encoding='utf-8')
        self.assertEqual(result, redis.brpoplpush.return_value)
Ejemplo n.º 2
0
    def test_move_without_block_rpoplpushes(self):
        redis = MagicMock()
        key = MagicMock()
        redis_list = RedisList(redis, key)
        destination_key = MagicMock()
        encoding = MagicMock()

        result = redis_list.move(destination_key,
                                 block=False,
                                 encoding=encoding)

        redis.rpoplpush.assert_called_once_with(key,
                                                destination_key,
                                                encoding=encoding)
        self.assertEqual(result, redis.rpoplpush.return_value)
Ejemplo n.º 3
0
    def test_move_with_block_brpoplpushes(self):
        redis = MagicMock()
        key = MagicMock()
        redis_list = RedisList(redis, key)
        destination_key = MagicMock()
        timeout = MagicMock()
        encoding = MagicMock()

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

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