From 92ebe0c83e4e4063a349a46a3a56e82b9310bf2c Mon Sep 17 00:00:00 2001 From: faucomte97 Date: Wed, 31 Jan 2024 16:11:19 +0000 Subject: [PATCH] Revert "Stop using setup class" This reverts commit 1134b8816d03b2bc2d73b3e127d39de0fb7aac42. --- .../auth/password_validators/test_independent.py | 11 +++++++---- .../tests/auth/password_validators/test_student.py | 7 +++++-- .../tests/auth/password_validators/test_teacher.py | 7 +++++-- 3 files changed, 17 insertions(+), 8 deletions(-) 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"