recopytex/tests/model/test_assessment.py

57 lines
1.4 KiB
Python
Raw Normal View History

from backend.model.assessment import Assessment, Domain, Exercise, Question, Skill
from backend.model.student import Tribe
def build_tribe():
return Tribe("plop", "2nd")
def build_tribe_assessment():
tribe = build_tribe()
assessment = Assessment("DS1", tribe, 1)
return tribe, assessment
def build_tribe_assessment_exercise():
tribe, assessment = build_tribe_assessment()
exercise = Exercise("ex1", assessment, "today")
return tribe, assessment, exercise
def build_skills():
return [Skill("search", "Searching and finding")]
def build_domains():
return [Domain("function", "Functions are great")]
def build_tribe_assessment_exercise_question():
tribe, assessment, exercise = build_tribe_assessment_exercise()
skills = build_skills()
domains = build_domains()
question = Question(
"a",
exercise,
description="desc",
skill=skills[0],
domain=domains[0],
is_leveled=True,
scale=1,
)
return tribe, assessment, exercise, question
def test_assessement_register_exercise():
tribe, assessment, exercise = build_tribe_assessment_exercise()
assert len(assessment.exercises) == 1
assert assessment.exercises[0] == exercise
def test_exercise_register_question():
tribe, assessment, exercise, question = build_tribe_assessment_exercise_question()
assert len(exercise.questions) == 1
assert exercise.questions[0] == question