# Path: tests_app/tests/functional/mixins/detail_serializer_mixin/models.py
# class Comment(models.Model):
#     email = models.EmailField()
#     content = models.CharField(max_length=200)
#     created = models.DateTimeField(auto_now_add=True)


import datetime
from django.test import TestCase, override_settings
from rest_framework.test import APIRequestFactory
from .models import Comment
            created=datetime.datetime.now()
        )

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

    def test_serializer_detail_class_response(self):
        resp = self.client.get('/comments/1/')
        expected = {
            'id': 1,
            'email': 'example@ya.ru',
            'content': 'Hello world',
        }
        self.assertEqual(resp.data, expected, 'should use detail serializer for detail endpoint')

    def test_view_with_mixin_and_without__serializer_detail_class__should_raise_exception(self):
        msg = "'CommentWithoutDetailSerializerClassViewSet' should include a 'serializer_detail_class' attribute"
        self.assertRaisesMessage(AssertionError, msg, self.client.get, '/comments-2/')


@override_settings(ROOT_URLCONF='tests_app.tests.functional.mixins.detail_serializer_mixin.urls')
class DetailSerializerMixin_queryset_detail(TestCase):

    def setUp(self):
        self.comments = [

# Path: tests_app/tests/functional/mixins/detail_serializer_mixin/models.py
# class Comment(models.Model):
#     email = models.EmailField()
#     content = models.CharField(max_length=200)
#     created = models.DateTimeField(auto_now_add=True)


# Path: tests_app/tests/functional/mixins/detail_serializer_mixin/tests.py
import datetime
from django.test import TestCase, override_settings
from rest_framework.test import APIRequestFactory
from .models import Comment

            created=datetime.datetime.now()
        )

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

    def test_serializer_detail_class_response(self):
        resp = self.client.get('/comments/1/')
        expected = {
            'id': 1,
            'email': 'example@ya.ru',
            'content': 'Hello world',
        }
        self.assertEqual(resp.data, expected, 'should use detail serializer for detail endpoint')

    def test_view_with_mixin_and_without__serializer_detail_class__should_raise_exception(self):
        msg = "'CommentWithoutDetailSerializerClassViewSet' should include a 'serializer_detail_class' attribute"
        self.assertRaisesMessage(AssertionError, msg, self.client.get, '/comments-2/')


@override_settings(ROOT_URLCONF='tests_app.tests.functional.mixins.detail_serializer_mixin.urls')
class DetailSerializerMixin_queryset_detail(TestCase):

    def setUp(self):
        self.comments = [

            Comment.objects.create(