"""This module contains the test case for the apiv2 -elated serializers of the ``documents`` app"""

from mtp.apps.common.tests.test_cases import WithMediaOnDisk
from mtp.apps.documents.tests.test_cases import DocumentTestCase

from ..serializers import DocumentSerializer


class DocumentSerializerTestCase(DocumentTestCase, WithMediaOnDisk):
    """Test case for the ``DocumentSerializer`` serializer"""

    def test_serializer_is_working_correctly(self):
        """Test that the serializer is working correctly"""

        serialized_document = DocumentSerializer(self.document)

        self.assertDictEqual(
            serialized_document.data,
            {
                'id': self.document.id,
                'name': self.document.name,
                'description': self.document.description,
                'activity_type': self.document.activity_type,
                'sort_order': self.document.sort_order,
                'session': self.document.session_id,
                'training': self.document.training_id,
                'trainee_document_file': self.document.trainee_document_file.url,
                'pdf_images_url_list': [],
                'needs_approval': self.document.needs_approval
            }
        )
