2022-12-20 07:23:52 +00:00
|
|
|
from random import randint
|
2022-12-27 07:00:28 +00:00
|
|
|
from uuid import UUID
|
2022-12-20 07:23:52 +00:00
|
|
|
|
2022-12-20 07:28:45 +00:00
|
|
|
from backend.model.student import Student
|
|
|
|
from backend.model.tribe import Tribe
|
2022-12-20 08:04:19 +00:00
|
|
|
from tests.model.fakes import build_assessments, build_tribes
|
2022-12-20 07:23:52 +00:00
|
|
|
|
|
|
|
|
2022-12-27 07:00:28 +00:00
|
|
|
def test_init_student():
|
|
|
|
tribe = build_tribes(1)[0]
|
|
|
|
student = Student(name="Bob", tribe=tribe)
|
|
|
|
print(student)
|
|
|
|
|
|
|
|
assert type(student.name) == str
|
|
|
|
assert type(student.tribe) == Tribe
|
|
|
|
assert type(student.id) == str
|
|
|
|
|
|
|
|
student2 = Student(name="Hop", tribe=tribe)
|
|
|
|
assert student.id != student2.id
|
|
|
|
|
|
|
|
|
2022-12-20 07:23:52 +00:00
|
|
|
def test_tribe_register_assessment():
|
|
|
|
assessments_qty = randint(1, 10)
|
2022-12-20 08:04:19 +00:00
|
|
|
tribes = build_tribes(1)
|
|
|
|
assessments = build_assessments(tribes, assessments_qty)
|
2022-12-20 07:23:52 +00:00
|
|
|
|
|
|
|
assert len(tribes[0].assessments) == assessments_qty
|
|
|
|
assert tribes[0].assessments == assessments
|
2022-12-20 05:59:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_tribe_register_student():
|
|
|
|
tribe = Tribe("foo", "2nd")
|
2022-12-26 10:46:29 +00:00
|
|
|
student = Student(id="1", name="Bob", tribe=tribe)
|
2022-12-20 05:59:35 +00:00
|
|
|
|
|
|
|
assert len(tribe.students) == 1
|
|
|
|
assert tribe.students[0] == student
|