"""This module holds the test cases for the utils of the ``evaluations`` module"""

from ..factories import RatingFactory
from ..models import Criterion
from ..utils import export_evaluation_stat_raw

from .test_cases import EvaluationTestCase


class EvaluationExportUtilsTestCase(EvaluationTestCase):
    """Test cases for the evaluations stats utils methods"""

    @classmethod
    def setUpTestData(cls):
        """Set up the test data"""

        super().setUpTestData()

        # Record some user answers for the evaluation
        for exercise in cls.evaluation.exercises.all():
            for criterion in exercise.criteria.filter(
                    criterion_type=Criterion.CRITERION_TYPES.QUALITATIVE):
                RatingFactory(
                    criterion=criterion,
                    judge=cls.trainer,
                    trainee=cls.trainee,
                    session=cls.training_session
                )

    def test_export_evaluation_stat_raw(self):
        """Test the ``export_evaluation_stat_raw`` method"""

        self.assertIsNotNone(
            export_evaluation_stat_raw(self.training_session)
        )
