From 1134b8816d03b2bc2d73b3e127d39de0fb7aac42 Mon Sep 17 00:00:00 2001 From: faucomte97 Date: Wed, 31 Jan 2024 16:02:31 +0000 Subject: [PATCH] Stop using setup class --- .../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, 8 insertions(+), 17 deletions(-) diff --git a/codeforlife/user/tests/auth/password_validators/test_independent.py b/codeforlife/user/tests/auth/password_validators/test_independent.py index 2b52fe4c..8bd96c06 100644 --- a/codeforlife/user/tests/auth/password_validators/test_independent.py +++ b/codeforlife/user/tests/auth/password_validators/test_independent.py @@ -9,13 +9,10 @@ class TestIndependentPasswordValidator(PasswordValidatorTestCase): - @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() + user = User.objects.filter( + new_teacher__isnull=True, new_student__isnull=True + ).first() + validator = IndependentPasswordValidator() 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 7485751f..256b0e15 100644 --- a/codeforlife/user/tests/auth/password_validators/test_student.py +++ b/codeforlife/user/tests/auth/password_validators/test_student.py @@ -9,11 +9,8 @@ class TestStudentPasswordValidator(PasswordValidatorTestCase): - @classmethod - def setUpClass(cls): - cls.user = User.objects.filter(new_student__isnull=False).first() - cls.validator = StudentPasswordValidator() - super(TestStudentPasswordValidator, cls).setUpClass() + user = User.objects.filter(new_student__isnull=False).first() + validator = StudentPasswordValidator() 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 cbcdaeef..552bf169 100644 --- a/codeforlife/user/tests/auth/password_validators/test_teacher.py +++ b/codeforlife/user/tests/auth/password_validators/test_teacher.py @@ -9,11 +9,8 @@ class TestTeacherPasswordValidator(PasswordValidatorTestCase): - @classmethod - def setUpClass(cls): - cls.user = User.objects.first() - cls.validator = TeacherPasswordValidator() - super(TestTeacherPasswordValidator, cls).setUpClass() + user = User.objects.first() + validator = TeacherPasswordValidator() def test_validate__password_too_short(self): password = "fxwSn4}PW"