diff --git a/codeforlife/user/tests/auth/password_validators/test_independent.py b/codeforlife/user/tests/auth/password_validators/test_independent.py index 8bd96c06..2b52fe4c 100644 --- a/codeforlife/user/tests/auth/password_validators/test_independent.py +++ b/codeforlife/user/tests/auth/password_validators/test_independent.py @@ -9,10 +9,13 @@ class TestIndependentPasswordValidator(PasswordValidatorTestCase): - user = User.objects.filter( - new_teacher__isnull=True, new_student__isnull=True - ).first() - validator = IndependentPasswordValidator() + @classmethod + def setUpClass(cls): + cls.user = User.objects.filter( + new_teacher__isnull=True, new_student__isnull=True + ).first() + cls.validator = IndependentPasswordValidator() + super(TestIndependentPasswordValidator, cls).setUpClass() def test_validate__password_too_short(self): password = "fxwSn4}" diff --git a/codeforlife/user/tests/auth/password_validators/test_student.py b/codeforlife/user/tests/auth/password_validators/test_student.py index 256b0e15..7485751f 100644 --- a/codeforlife/user/tests/auth/password_validators/test_student.py +++ b/codeforlife/user/tests/auth/password_validators/test_student.py @@ -9,8 +9,11 @@ class TestStudentPasswordValidator(PasswordValidatorTestCase): - user = User.objects.filter(new_student__isnull=False).first() - validator = StudentPasswordValidator() + @classmethod + def setUpClass(cls): + cls.user = User.objects.filter(new_student__isnull=False).first() + cls.validator = StudentPasswordValidator() + super(TestStudentPasswordValidator, cls).setUpClass() def test_validate__password_too_short(self): password = "fxwSn" diff --git a/codeforlife/user/tests/auth/password_validators/test_teacher.py b/codeforlife/user/tests/auth/password_validators/test_teacher.py index 552bf169..cbcdaeef 100644 --- a/codeforlife/user/tests/auth/password_validators/test_teacher.py +++ b/codeforlife/user/tests/auth/password_validators/test_teacher.py @@ -9,8 +9,11 @@ class TestTeacherPasswordValidator(PasswordValidatorTestCase): - user = User.objects.first() - validator = TeacherPasswordValidator() + @classmethod + def setUpClass(cls): + cls.user = User.objects.first() + cls.validator = TeacherPasswordValidator() + super(TestTeacherPasswordValidator, cls).setUpClass() def test_validate__password_too_short(self): password = "fxwSn4}PW"