Skip to content
Snippets Groups Projects
Commit 07a12540 authored by Jan Maximilian Michal's avatar Jan Maximilian Michal
Browse files

Merge branch 'fix-data-factory' into 'master'

Password is now set when specified in dictionary

See merge request !31
parents de7c4559 0d3e7776
No related branches found
No related tags found
1 merge request!31Password is now set when specified in dictionary
Pipeline #
...@@ -62,8 +62,10 @@ class GradyUserFactory: ...@@ -62,8 +62,10 @@ class GradyUserFactory:
username=username, username=username,
defaults=kwargs) defaults=kwargs)
if created: if created or password is not None:
password = self.password_generator_func() if password is None else password password = self.password_generator_func() if password is None \
else password
print(password)
user.set_password(password) user.set_password(password)
user.save() user.save()
...@@ -129,7 +131,8 @@ def make_submission_types(submission_types=[], **kwargs): ...@@ -129,7 +131,8 @@ def make_submission_types(submission_types=[], **kwargs):
def make_students(students=[], **kwargs): def make_students(students=[], **kwargs):
return [GradyUserFactory().make_student( return [GradyUserFactory().make_student(
username=student['username'], username=student['username'],
exam=ExamType.objects.get(module_reference=student['exam']) exam=ExamType.objects.get(module_reference=student['exam']),
password=student.get('password', None)
) for student in students] ) for student in students]
...@@ -216,6 +219,7 @@ def init_test_instance(): ...@@ -216,6 +219,7 @@ def init_test_instance():
'students': [{ 'students': [{
'username': 'student01', 'username': 'student01',
'exam': 'Test Exam 01', 'exam': 'Test Exam 01',
'password': 'p'
}], }],
'tutors': [{ 'tutors': [{
'username': 'tutor01' 'username': 'tutor01'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment