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

from mtp.apps.evaluations.tests.test_cases import EvaluationTestCase

from ..serializers import EvaluationSerializer, ExerciseSerializer


class EvaluationSerializerTestCase(EvaluationTestCase):
    """Test case for the ``EvaluationSerializer`` serializer"""

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

        serializer = EvaluationSerializer(self.evaluation)

        self.assertEqual(
            serializer.data,
            {
                'id': self.evaluation.id,
                'name': self.evaluation.name,
                'description': self.evaluation.description,
                'activity_type': self.evaluation.activity_type,
                'sort_order': self.evaluation.sort_order,
                'session': self.evaluation.session_id,
                'training': self.evaluation.training_id,
                'type': self.evaluation.evaluation_type,
                'exercises': [
                    ExerciseSerializer(exercise).data
                    for exercise in self.evaluation.exercises.non_deleted()
                ]
            }
        )

