From 0d3e77769b31cbf359cb2dd86897a5dd63d6655e Mon Sep 17 00:00:00 2001
From: "robinwilliam.hundt" <robinwilliam.hundt@stud.uni-goettingen.de>
Date: Fri, 22 Dec 2017 21:49:34 +0100
Subject: [PATCH] passowrd is now set when specified in dictionary

---
 util/factories.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/util/factories.py b/util/factories.py
index 5b6f7157..8888c043 100644
--- a/util/factories.py
+++ b/util/factories.py
@@ -62,8 +62,10 @@ class GradyUserFactory:
             username=username,
             defaults=kwargs)
 
-        if created:
-            password = self.password_generator_func() if password is None else password
+        if created or password is not None:
+            password = self.password_generator_func() if password is None \
+                else password
+            print(password)
             user.set_password(password)
             user.save()
 
@@ -129,7 +131,8 @@ def make_submission_types(submission_types=[], **kwargs):
 def make_students(students=[], **kwargs):
     return [GradyUserFactory().make_student(
         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]
 
 
@@ -216,6 +219,7 @@ def init_test_instance():
             'students': [{
                 'username': 'student01',
                 'exam': 'Test Exam 01',
+                'password': 'p'
             }],
             'tutors': [{
                 'username': 'tutor01'
-- 
GitLab