Commit ca1f76ce by David Ormsbee

Move more tests to use bulk_operations.

parent ae1853bc
......@@ -242,6 +242,7 @@ class ViewsTestCase(ModuleStoreTestCase):
def setUp(self):
super(ViewsTestCase, self).setUp()
self.course = CourseFactory.create(display_name=u'teꜱᴛ course', run="Testing_course")
with self.store.bulk_operations(self.course.id):
self.chapter = ItemFactory.create(
category='chapter',
parent_location=self.course.location,
......@@ -989,6 +990,7 @@ class BaseDueDateTests(ModuleStoreTestCase):
:param course_kwargs: All kwargs are passed to through to the :class:`CourseFactory`
"""
course = CourseFactory.create(**course_kwargs)
with self.store.bulk_operations(course.id):
chapter = ItemFactory.create(category='chapter', parent_location=course.location)
section = ItemFactory.create(
category='sequential',
......@@ -1149,19 +1151,18 @@ class ProgressPageTests(ModuleStoreTestCase):
def setup_course(self, **options):
"""Create the test course."""
course = CourseFactory.create(
self.course = CourseFactory.create(
start=datetime(2013, 9, 16, 7, 17, 28),
grade_cutoffs={u'çü†øƒƒ': 0.75, 'Pass': 0.5},
**options
)
self.course = modulestore().get_course(course.id)
CourseEnrollmentFactory(user=self.user, course_id=self.course.id, mode=CourseMode.HONOR)
with self.store.bulk_operations(self.course.id):
self.chapter = ItemFactory.create(category='chapter', parent_location=self.course.location)
self.section = ItemFactory.create(category='sequential', parent_location=self.chapter.location)
self.vertical = ItemFactory.create(category='vertical', parent_location=self.section.location)
CourseEnrollmentFactory(user=self.user, course_id=self.course.id, mode=CourseMode.HONOR)
def _get_progress_page(self, expected_status_code=200):
"""
Gets the progress page for the user in the course.
......@@ -1898,6 +1899,7 @@ class TestIndexView(ModuleStoreTestCase):
user = UserFactory()
course = CourseFactory.create()
with self.store.bulk_operations(course.id):
chapter = ItemFactory.create(parent=course, category='chapter')
section = ItemFactory.create(parent=chapter, category='sequential', display_name="Sequence")
vertical = ItemFactory.create(parent=section, category='vertical', display_name="Vertical")
......@@ -1936,6 +1938,7 @@ class TestIndexViewWithVerticalPositions(ModuleStoreTestCase):
# create course with 3 positions
self.course = CourseFactory.create()
with self.store.bulk_operations(self.course.id):
self.chapter = ItemFactory.create(parent=self.course, category='chapter')
self.section = ItemFactory.create(parent=self.chapter, category='sequential', display_name="Sequence")
ItemFactory.create(parent=self.section, category='vertical', display_name="Vertical1")
......@@ -1995,14 +1998,20 @@ class TestIndexViewWithGating(ModuleStoreTestCase, MilestonesTestCaseMixin):
self.user = UserFactory()
self.course = CourseFactory.create()
with self.store.bulk_operations(self.course.id):
self.course.enable_subsection_gating = True
self.course.save()
self.store.update_item(self.course, 0)
self.chapter = ItemFactory.create(parent=self.course, category="chapter", display_name="Chapter")
self.open_seq = ItemFactory.create(parent=self.chapter, category='sequential', display_name="Open Sequential")
self.open_seq = ItemFactory.create(
parent=self.chapter, category='sequential', display_name="Open Sequential"
)
ItemFactory.create(parent=self.open_seq, category='problem', display_name="Problem 1")
self.gated_seq = ItemFactory.create(parent=self.chapter, category='sequential', display_name="Gated Sequential")
self.gated_seq = ItemFactory.create(
parent=self.chapter, category='sequential', display_name="Gated Sequential"
)
ItemFactory.create(parent=self.gated_seq, category='problem', display_name="Problem 2")
gating_api.add_prerequisite(self.course.id, self.open_seq.location)
gating_api.set_required_content(self.course.id, self.gated_seq.location, self.open_seq.location, 100)
......
......@@ -148,6 +148,7 @@ class TestWeightedProblems(SharedModuleStoreTestCase):
def setUpClass(cls):
super(TestWeightedProblems, cls).setUpClass()
cls.course = CourseFactory.create()
with cls.store.bulk_operations(cls.course.id):
cls.chapter = ItemFactory.create(parent=cls.course, category="chapter", display_name="chapter")
cls.sequential = ItemFactory.create(parent=cls.chapter, category="sequential", display_name="sequential")
cls.vertical = ItemFactory.create(parent=cls.sequential, category="vertical", display_name="vertical1")
......@@ -261,6 +262,7 @@ class TestScoreForModule(SharedModuleStoreTestCase):
def setUpClass(cls):
super(TestScoreForModule, cls).setUpClass()
cls.course = CourseFactory.create()
with cls.store.bulk_operations(cls.course.id):
cls.a = ItemFactory.create(parent=cls.course, category="chapter", display_name="a")
cls.b = ItemFactory.create(parent=cls.a, category="sequential", display_name="b")
cls.c = ItemFactory.create(parent=cls.a, category="sequential", display_name="c")
......@@ -341,6 +343,7 @@ class TestGetModuleScore(LoginEnrollmentTestCase, SharedModuleStoreTestCase):
def setUpClass(cls):
super(TestGetModuleScore, cls).setUpClass()
cls.course = CourseFactory.create()
with cls.store.bulk_operations(cls.course.id):
cls.chapter = ItemFactory.create(
parent=cls.course,
category="chapter",
......
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