Commit 1f64506c by David Ormsbee

Merge pull request #9507 from edx/ormsbee/faster_tests_comment_client

Convert CohortedTestCase to use SharedModuleStoreTestCase.
parents a8cc5850 9bac3579
...@@ -8,23 +8,32 @@ from django_comment_common.models import Role ...@@ -8,23 +8,32 @@ from django_comment_common.models import Role
from django_comment_common.utils import seed_permissions_roles from django_comment_common.utils import seed_permissions_roles
from student.tests.factories import CourseEnrollmentFactory, UserFactory from student.tests.factories import CourseEnrollmentFactory, UserFactory
from xmodule.modulestore.tests.factories import CourseFactory from xmodule.modulestore.tests.factories import CourseFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
class CohortedTestCase(ModuleStoreTestCase): class CohortedTestCase(SharedModuleStoreTestCase):
""" """
Sets up a course with a student, a moderator and their cohorts. Sets up a course with a student, a moderator and their cohorts.
""" """
@classmethod
@patch.dict("django.conf.settings.FEATURES", {"ENABLE_DISCUSSION_SERVICE": True}) @patch.dict("django.conf.settings.FEATURES", {"ENABLE_DISCUSSION_SERVICE": True})
def setUp(self): def setUpClass(cls):
super(CohortedTestCase, self).setUp() super(CohortedTestCase, cls).setUpClass()
cls.course = CourseFactory.create(
self.course = CourseFactory.create(
cohort_config={ cohort_config={
"cohorted": True, "cohorted": True,
"cohorted_discussions": ["cohorted_topic"] "cohorted_discussions": ["cohorted_topic"]
} }
) )
cls.course.discussion_topics["cohorted topic"] = {"id": "cohorted_topic"}
cls.course.discussion_topics["non-cohorted topic"] = {"id": "non_cohorted_topic"}
fake_user_id = 1
cls.store.update_item(cls.course, fake_user_id)
@patch.dict("django.conf.settings.FEATURES", {"ENABLE_DISCUSSION_SERVICE": True})
def setUp(self):
super(CohortedTestCase, self).setUp()
self.student_cohort = CohortFactory.create( self.student_cohort = CohortFactory.create(
name="student_cohort", name="student_cohort",
course_id=self.course.id course_id=self.course.id
...@@ -33,10 +42,6 @@ class CohortedTestCase(ModuleStoreTestCase): ...@@ -33,10 +42,6 @@ class CohortedTestCase(ModuleStoreTestCase):
name="moderator_cohort", name="moderator_cohort",
course_id=self.course.id course_id=self.course.id
) )
self.course.discussion_topics["cohorted topic"] = {"id": "cohorted_topic"}
self.course.discussion_topics["non-cohorted topic"] = {"id": "non_cohorted_topic"}
self.store.update_item(self.course, self.user.id)
seed_permissions_roles(self.course.id) seed_permissions_roles(self.course.id)
self.student = UserFactory.create() self.student = UserFactory.create()
self.moderator = UserFactory.create() self.moderator = UserFactory.create()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment