48 lines
1.4 KiB
Python
48 lines
1.4 KiB
Python
|
from factory import alchemy, Sequence
|
||
|
from factory.faker import Faker
|
||
|
from factory.fuzzy import FuzzyInteger, FuzzyChoice
|
||
|
|
||
|
from ..app.dependencies import db
|
||
|
from ..app.students.models import Student, Group
|
||
|
from ..app.project_supervisor.models import ProjectSupervisor, YearGroupProjectSupervisors
|
||
|
|
||
|
|
||
|
class ProjectSupervisorFactory(alchemy.SQLAlchemyModelFactory):
|
||
|
class Meta:
|
||
|
model = ProjectSupervisor
|
||
|
sqlalchemy_session = db.session
|
||
|
|
||
|
first_name = Faker('first_name')
|
||
|
last_name = Faker('last_name')
|
||
|
email = Faker('email')
|
||
|
|
||
|
|
||
|
class YearGroupProjectSupervisorsFactory(alchemy.SQLAlchemyModelFactory):
|
||
|
class Meta:
|
||
|
model = YearGroupProjectSupervisors
|
||
|
sqlalchemy_session = db.session
|
||
|
|
||
|
limit_group = 4
|
||
|
|
||
|
class GroupFactory(alchemy.SQLAlchemyModelFactory):
|
||
|
class Meta:
|
||
|
model = Group
|
||
|
sqlalchemy_session = db.session
|
||
|
|
||
|
name = Sequence(lambda n: f'Group-{n}')
|
||
|
points_for_first_term = FuzzyInteger(1, 5)
|
||
|
points_for_second_term = FuzzyInteger(1, 5)
|
||
|
|
||
|
#
|
||
|
# class StudentFactory(alchemy.SQLAlchemyModelFactory):
|
||
|
# class Meta:
|
||
|
# model = Student
|
||
|
# sqlalchemy_session = db.session
|
||
|
#
|
||
|
# first_name = Faker('first_name')
|
||
|
# last_name = Faker('last_name')
|
||
|
# email = Faker('email')
|
||
|
# index = Sequence(lambda n: 400_000 + n)
|
||
|
# # group = RelatedFactory(GroupFactory)
|
||
|
# mode = FuzzyChoice([True, False])
|