From aa16142659fd2c4b925bcc5c2d1992fbf6888a4e Mon Sep 17 00:00:00 2001 From: Awais Qureshi Date: Sat, 2 Oct 2021 00:45:18 +0500 Subject: [PATCH] fix: Fixing test due to the change in django32. Objects assigned to class attributes in TestCase.setUpTestData() are now isolated for each test method. https://docs.djangoproject.com/en/3.2/releases/3.2/#tests BOM-2866 --- lms/djangoapps/teams/tests/test_views.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lms/djangoapps/teams/tests/test_views.py b/lms/djangoapps/teams/tests/test_views.py index 42d5d651ae..d67e86068b 100644 --- a/lms/djangoapps/teams/tests/test_views.py +++ b/lms/djangoapps/teams/tests/test_views.py @@ -373,15 +373,17 @@ class TeamAPITestCase(APITestCase, SharedModuleStoreTestCase): teams_configuration=teams_configuration_2 ) + cls.users = { + 'staff': AdminFactory.create(password=cls.test_password), + 'course_staff': StaffFactory.create(course_key=cls.test_course_1.id, password=cls.test_password), + 'admin': AdminFactory.create(password=cls.test_password) + } + + @classmethod def setUpTestData(cls): super().setUpTestData() cls.topics_count = 6 - cls.users = { - 'staff': AdminFactory.create(password=cls.test_password), - 'course_staff': StaffFactory.create(course_key=cls.test_course_1.id, password=cls.test_password), - 'admin': AdminFactory.create(password=cls.test_password) - } cls.create_and_enroll_student(username='student_enrolled') cls.create_and_enroll_student(username='student_on_team_1_private_set_1', mode=CourseMode.MASTERS) cls.create_and_enroll_student(username='student_on_team_2_private_set_1', mode=CourseMode.MASTERS)