Пример #1
0
    def test_get_range_passes_correct_defaults(self):
        redis = MagicMock()
        key = MagicMock()
        redis_list = RedisList(redis, key)

        result = redis_list.get_range()

        redis.lrange.assert_called_once_with(key, 0, -1, encoding='utf-8')
        self.assertEqual(result, redis.lrange.return_value)
Пример #2
0
    def test_get_range_works_correctly(self):
        redis = MagicMock()
        key = MagicMock()
        redis_list = RedisList(redis, key)
        start = MagicMock()
        stop = MagicMock()
        encoding = MagicMock()

        result = redis_list.get_range(start, stop, encoding=encoding)

        redis.lrange.assert_called_once_with(key,
                                             start,
                                             stop,
                                             encoding=encoding)
        self.assertEqual(result, redis.lrange.return_value)