# Path: rest_framework_extensions/settings.py
# USER_SETTINGS = getattr(settings, 'REST_FRAMEWORK_EXTENSIONS', None)
# DEFAULTS = {
#     # caching
#     'DEFAULT_USE_CACHE': 'default',
#     'DEFAULT_CACHE_RESPONSE_TIMEOUT': None,
#     'DEFAULT_CACHE_ERRORS': True,
#     'DEFAULT_CACHE_KEY_FUNC': 'rest_framework_extensions.utils.default_cache_key_func',
#     'DEFAULT_OBJECT_CACHE_KEY_FUNC': 'rest_framework_extensions.utils.default_object_cache_key_func',
#     'DEFAULT_LIST_CACHE_KEY_FUNC': 'rest_framework_extensions.utils.default_list_cache_key_func',
# 
#     # ETAG
#     'DEFAULT_ETAG_FUNC': 'rest_framework_extensions.utils.default_etag_func',
#     'DEFAULT_OBJECT_ETAG_FUNC': 'rest_framework_extensions.utils.default_object_etag_func',
#     'DEFAULT_LIST_ETAG_FUNC': 'rest_framework_extensions.utils.default_list_etag_func',
# 
#     # API - ETAG
#     'DEFAULT_API_OBJECT_ETAG_FUNC': 'rest_framework_extensions.utils.default_api_object_etag_func',
#     'DEFAULT_API_LIST_ETAG_FUNC': 'rest_framework_extensions.utils.default_api_list_etag_func',
# 
#     # other
#     'DEFAULT_KEY_CONSTRUCTOR_MEMOIZE_FOR_REQUEST': False,
#     'DEFAULT_BULK_OPERATION_HEADER_NAME': 'X-BULK-OPERATION',
#     'DEFAULT_PARENT_LOOKUP_KWARG_NAME_PREFIX': 'parent_lookup_'
# }
# IMPORT_STRINGS = [
#     'DEFAULT_CACHE_KEY_FUNC',
#     'DEFAULT_OBJECT_CACHE_KEY_FUNC',
#     'DEFAULT_LIST_CACHE_KEY_FUNC',
#     'DEFAULT_ETAG_FUNC',
#     'DEFAULT_OBJECT_ETAG_FUNC',
#     'DEFAULT_LIST_ETAG_FUNC',
#     # API - ETAG
#     'DEFAULT_API_OBJECT_ETAG_FUNC',
#     'DEFAULT_API_LIST_ETAG_FUNC',
# ]
# 
# Path: rest_framework_extensions/utils.py
# def get_rest_framework_version():
# def flatten(list_of_lists):
# def prepare_header_name(name):
# def get_unique_method_id(view_instance, view_method):
# def get_model_opts_concrete_fields(opts):
# def compose_parent_pk_kwarg_name(value):
# 
# Path: tests_app/tests/functional/mixins/list_destroy_model_mixin/models.py
# class CommentForListDestroyModelMixin(models.Model):
#     email = models.EmailField()
# 
# Path: tests_app/testutils.py
# def override_extensions_api_settings(**kwargs):
#     return patch.multiple(
#         'rest_framework_extensions.settings.extensions_api_settings',
#         **kwargs
#     )


from django.test import override_settings
from rest_framework.test import APITestCase
from rest_framework_extensions.settings import extensions_api_settings
from rest_framework_extensions import utils
from .models import CommentForListDestroyModelMixin as Comment
from tests_app.testutils import override_extensions_api_settings
                'id': 1,
                'email': 'example@ya.ru'
            },
            {
                'id': 2,
                'email': 'example@gmail.com'
            }
        ]
        self.assertEqual(resp.data, expected)

    def test_filter_works(self):
        resp = self.client.get('/comments/?id=1')
        expected = [
            {
                'id': 1,
                'email': 'example@ya.ru'
            }
        ]
        self.assertEqual(resp.data, expected)

    def test_destroy_instance(self):
        resp = self.client.delete('/comments/1/')
        self.assertEqual(resp.status_code, 204)
        self.assertFalse(1 in Comment.objects.values_list('pk', flat=True))

    def test_bulk_destroy__without_protection_header(self):
        resp = self.client.delete('/comments/')
        self.assertEqual(resp.status_code, 400)
        expected_message = {
            'detail': 'Header \'{0}\' should be provided for bulk operation.'.format(

# Path: rest_framework_extensions/settings.py
# USER_SETTINGS = getattr(settings, 'REST_FRAMEWORK_EXTENSIONS', None)
# DEFAULTS = {
#     # caching
#     'DEFAULT_USE_CACHE': 'default',
#     'DEFAULT_CACHE_RESPONSE_TIMEOUT': None,
#     'DEFAULT_CACHE_ERRORS': True,
#     'DEFAULT_CACHE_KEY_FUNC': 'rest_framework_extensions.utils.default_cache_key_func',
#     'DEFAULT_OBJECT_CACHE_KEY_FUNC': 'rest_framework_extensions.utils.default_object_cache_key_func',
#     'DEFAULT_LIST_CACHE_KEY_FUNC': 'rest_framework_extensions.utils.default_list_cache_key_func',
# 
#     # ETAG
#     'DEFAULT_ETAG_FUNC': 'rest_framework_extensions.utils.default_etag_func',
#     'DEFAULT_OBJECT_ETAG_FUNC': 'rest_framework_extensions.utils.default_object_etag_func',
#     'DEFAULT_LIST_ETAG_FUNC': 'rest_framework_extensions.utils.default_list_etag_func',
# 
#     # API - ETAG
#     'DEFAULT_API_OBJECT_ETAG_FUNC': 'rest_framework_extensions.utils.default_api_object_etag_func',
#     'DEFAULT_API_LIST_ETAG_FUNC': 'rest_framework_extensions.utils.default_api_list_etag_func',
# 
#     # other
#     'DEFAULT_KEY_CONSTRUCTOR_MEMOIZE_FOR_REQUEST': False,
#     'DEFAULT_BULK_OPERATION_HEADER_NAME': 'X-BULK-OPERATION',
#     'DEFAULT_PARENT_LOOKUP_KWARG_NAME_PREFIX': 'parent_lookup_'
# }
# IMPORT_STRINGS = [
#     'DEFAULT_CACHE_KEY_FUNC',
#     'DEFAULT_OBJECT_CACHE_KEY_FUNC',
#     'DEFAULT_LIST_CACHE_KEY_FUNC',
#     'DEFAULT_ETAG_FUNC',
#     'DEFAULT_OBJECT_ETAG_FUNC',
#     'DEFAULT_LIST_ETAG_FUNC',
#     # API - ETAG
#     'DEFAULT_API_OBJECT_ETAG_FUNC',
#     'DEFAULT_API_LIST_ETAG_FUNC',
# ]
# 
# Path: rest_framework_extensions/utils.py
# def get_rest_framework_version():
# def flatten(list_of_lists):
# def prepare_header_name(name):
# def get_unique_method_id(view_instance, view_method):
# def get_model_opts_concrete_fields(opts):
# def compose_parent_pk_kwarg_name(value):
# 
# Path: tests_app/tests/functional/mixins/list_destroy_model_mixin/models.py
# class CommentForListDestroyModelMixin(models.Model):
#     email = models.EmailField()
# 
# Path: tests_app/testutils.py
# def override_extensions_api_settings(**kwargs):
#     return patch.multiple(
#         'rest_framework_extensions.settings.extensions_api_settings',
#         **kwargs
#     )


# Path: tests_app/tests/functional/mixins/list_destroy_model_mixin/tests.py
from django.test import override_settings
from rest_framework.test import APITestCase
from rest_framework_extensions.settings import extensions_api_settings
from rest_framework_extensions import utils
from .models import CommentForListDestroyModelMixin as Comment
from tests_app.testutils import override_extensions_api_settings

                'id': 1,
                'email': 'example@ya.ru'
            },
            {
                'id': 2,
                'email': 'example@gmail.com'
            }
        ]
        self.assertEqual(resp.data, expected)

    def test_filter_works(self):
        resp = self.client.get('/comments/?id=1')
        expected = [
            {
                'id': 1,
                'email': 'example@ya.ru'
            }
        ]
        self.assertEqual(resp.data, expected)

    def test_destroy_instance(self):
        resp = self.client.delete('/comments/1/')
        self.assertEqual(resp.status_code, 204)
        self.assertFalse(1 in Comment.objects.values_list('pk', flat=True))

    def test_bulk_destroy__without_protection_header(self):
        resp = self.client.delete('/comments/')
        self.assertEqual(resp.status_code, 400)
        expected_message = {
            'detail': 'Header \'{0}\' should be provided for bulk operation.'.format(

                extensions_api_settings.DEFAULT_BULK_OPERATION_HEADER_NAME