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
This commit is contained in:
Awais Qureshi
2021-10-02 00:45:18 +05:00
parent 8d62b8db2b
commit aa16142659

View File

@@ -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)