from datetime import timedelta from io import BytesIO from tempfile import TemporaryDirectory from unittest.mock import patch from django.contrib.auth.models import User from django.db import IntegrityError, transaction from django.core.exceptions import ValidationError from django.core.management import call_command from django.core.files.uploadedfile import SimpleUploadedFile from django.test import TestCase, override_settings from django.urls import reverse from django.utils import timezone from django.template import Context, Template from accounts.models import PremiumEntitlement from .models import ExamSet, Question, QuestionGroup, Section, StudentAnswer, StudentAttempt from .html_importer import create_exam_from_payload, parse_ielts_html from .excel_importer import build_excel_template, parse_excel_test from .views import SUBMISSION_GRACE_SECONDS from .grading import academic_reading_band IMPORT_HTML = b'''
This is the reading passage.
Choose the correct answer.