refactor: rename ItemFactory to BlockFactory
This commit is contained in:
@@ -15,7 +15,7 @@ from opaque_keys.edx.locator import BlockUsageLocator, CourseLocator
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory, check_mongo_calls
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, BlockFactory, check_mongo_calls
|
||||
|
||||
from openedx.core.djangolib.testing.utils import skip_unless_lms
|
||||
from common.djangoapps.student.tests.factories import AdminFactory, UserFactory
|
||||
@@ -57,31 +57,31 @@ class BookmarksTestsBase(ModuleStoreTestCase):
|
||||
self.course = CourseFactory.create(display_name='An Introduction to API Testing')
|
||||
self.course_id = str(self.course.id)
|
||||
|
||||
self.chapter_1 = ItemFactory.create(
|
||||
self.chapter_1 = BlockFactory.create(
|
||||
parent=self.course, category='chapter', display_name='Week 1'
|
||||
)
|
||||
self.chapter_2 = ItemFactory.create(
|
||||
self.chapter_2 = BlockFactory.create(
|
||||
parent=self.course, category='chapter', display_name='Week 2'
|
||||
)
|
||||
|
||||
self.sequential_1 = ItemFactory.create(
|
||||
self.sequential_1 = BlockFactory.create(
|
||||
parent=self.chapter_1, category='sequential', display_name='Lesson 1'
|
||||
)
|
||||
self.sequential_2 = ItemFactory.create(
|
||||
self.sequential_2 = BlockFactory.create(
|
||||
parent=self.chapter_1, category='sequential', display_name='Lesson 2'
|
||||
)
|
||||
|
||||
self.vertical_1 = ItemFactory.create(
|
||||
self.vertical_1 = BlockFactory.create(
|
||||
parent=self.sequential_1, category='vertical', display_name='Subsection 1'
|
||||
)
|
||||
self.vertical_2 = ItemFactory.create(
|
||||
self.vertical_2 = BlockFactory.create(
|
||||
parent=self.sequential_2, category='vertical', display_name='Subsection 2'
|
||||
)
|
||||
self.vertical_3 = ItemFactory.create(
|
||||
self.vertical_3 = BlockFactory.create(
|
||||
parent=self.sequential_2, category='vertical', display_name='Subsection 3'
|
||||
)
|
||||
|
||||
self.html_1 = ItemFactory.create(
|
||||
self.html_1 = BlockFactory.create(
|
||||
parent=self.vertical_2, category='html', display_name='Details 1'
|
||||
)
|
||||
|
||||
@@ -131,19 +131,19 @@ class BookmarksTestsBase(ModuleStoreTestCase):
|
||||
|
||||
with self.store.bulk_operations(self.other_course.id):
|
||||
|
||||
self.other_chapter_1 = ItemFactory.create(
|
||||
self.other_chapter_1 = BlockFactory.create(
|
||||
parent=self.other_course, category='chapter', display_name='Other Week 1'
|
||||
)
|
||||
self.other_sequential_1 = ItemFactory.create(
|
||||
self.other_sequential_1 = BlockFactory.create(
|
||||
parent=self.other_chapter_1, category='sequential', display_name='Other Lesson 1'
|
||||
)
|
||||
self.other_sequential_2 = ItemFactory.create(
|
||||
self.other_sequential_2 = BlockFactory.create(
|
||||
parent=self.other_chapter_1, category='sequential', display_name='Other Lesson 2'
|
||||
)
|
||||
self.other_vertical_1 = ItemFactory.create(
|
||||
self.other_vertical_1 = BlockFactory.create(
|
||||
parent=self.other_sequential_1, category='vertical', display_name='Other Subsection 1'
|
||||
)
|
||||
self.other_vertical_2 = ItemFactory.create(
|
||||
self.other_vertical_2 = BlockFactory.create(
|
||||
parent=self.other_sequential_1, category='vertical', display_name='Other Subsection 2'
|
||||
)
|
||||
|
||||
@@ -179,7 +179,7 @@ class BookmarksTestsBase(ModuleStoreTestCase):
|
||||
|
||||
for block in blocks_at_current_level:
|
||||
for __ in range(children_per_block):
|
||||
blocks_at_next_level += [ItemFactory.create(
|
||||
blocks_at_next_level += [BlockFactory.create(
|
||||
parent_location=block.location, display_name=str(display_name)
|
||||
)]
|
||||
display_name += 1
|
||||
@@ -195,7 +195,7 @@ class BookmarksTestsBase(ModuleStoreTestCase):
|
||||
|
||||
course = CourseFactory.create()
|
||||
|
||||
blocks = [ItemFactory.create(
|
||||
blocks = [BlockFactory.create(
|
||||
parent=course, category='chapter', display_name=str(index)
|
||||
) for index in range(count)]
|
||||
|
||||
@@ -251,7 +251,7 @@ class BookmarkModelTests(BookmarksTestsBase):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
self.vertical_4 = ItemFactory.create(
|
||||
self.vertical_4 = BlockFactory.create(
|
||||
parent=self.sequential_2,
|
||||
category='vertical',
|
||||
display_name=None
|
||||
@@ -344,7 +344,7 @@ class BookmarkModelTests(BookmarksTestsBase):
|
||||
block_path = [PathItem(UsageKey.from_string(EXAMPLE_USAGE_KEY_1), '1')]
|
||||
mock_get_path.return_value = block_path
|
||||
|
||||
html = ItemFactory.create(
|
||||
html = BlockFactory.create(
|
||||
parent=self.other_chapter_1, category='html', display_name='Other Lesson 1'
|
||||
)
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ Tests for tasks.
|
||||
import ddt
|
||||
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.tests.factories import ItemFactory, check_mongo_calls
|
||||
from xmodule.modulestore.tests.factories import BlockFactory, check_mongo_calls
|
||||
|
||||
from ..models import XBlockCache
|
||||
from ..tasks import _calculate_course_xblocks_data, _update_xblocks_cache
|
||||
@@ -164,7 +164,7 @@ class XBlockCacheTaskTests(BookmarksTestsBase):
|
||||
"""
|
||||
Test that the xblocks data is persisted correctly with display_name=None.
|
||||
"""
|
||||
block_with_display_name_none = ItemFactory.create(
|
||||
block_with_display_name_none = BlockFactory.create(
|
||||
parent=self.sequential_2,
|
||||
category='vertical', display_name=None
|
||||
)
|
||||
|
||||
@@ -10,7 +10,7 @@ import pytz
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, BlockFactory
|
||||
|
||||
from openedx.core.djangoapps.ccxcon import api as ccxconapi
|
||||
from common.djangoapps.student.tests.factories import AdminFactory
|
||||
@@ -51,16 +51,16 @@ class APIsTestCase(SharedModuleStoreTestCase):
|
||||
)
|
||||
|
||||
cls.chapters = [
|
||||
ItemFactory.create(start=start, parent=course) for _ in range(2)
|
||||
BlockFactory.create(start=start, parent=course) for _ in range(2)
|
||||
]
|
||||
cls.sequentials = flatten([
|
||||
[
|
||||
ItemFactory.create(parent=chapter) for _ in range(2)
|
||||
BlockFactory.create(parent=chapter) for _ in range(2)
|
||||
] for chapter in cls.chapters
|
||||
])
|
||||
cls.verticals = flatten([
|
||||
[
|
||||
ItemFactory.create(
|
||||
BlockFactory.create(
|
||||
start=start, due=due, parent=sequential, graded=True, format='Homework', category='vertical'
|
||||
) for _ in range(2)
|
||||
] for sequential in cls.sequentials
|
||||
@@ -71,7 +71,7 @@ class APIsTestCase(SharedModuleStoreTestCase):
|
||||
with cls.store.bulk_operations(course.id, emit_signals=False):
|
||||
blocks = flatten([ # pylint: disable=unused-variable
|
||||
[
|
||||
ItemFactory.create(parent=vertical) for _ in range(2)
|
||||
BlockFactory.create(parent=vertical) for _ in range(2)
|
||||
] for vertical in cls.verticals
|
||||
])
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ from unittest.mock import patch # lint-amnesty, pylint: disable=wrong-import-or
|
||||
|
||||
from edx_toggles.toggles.testutils import override_waffle_flag
|
||||
from xmodule.modulestore.tests.django_utils import TEST_DATA_SPLIT_MODULESTORE, ModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, BlockFactory
|
||||
|
||||
from cms.djangoapps.contentstore.config.waffle import CUSTOM_RELATIVE_DATES
|
||||
from openedx.core.djangoapps.course_date_signals.handlers import (
|
||||
@@ -25,7 +25,7 @@ class SelfPacedDueDatesTests(ModuleStoreTestCase): # lint-amnesty, pylint: disa
|
||||
super().setUp()
|
||||
course = CourseFactory.create()
|
||||
for i in range(4):
|
||||
ItemFactory(parent=course, category="sequential", display_name=f"Section {i}")
|
||||
BlockFactory(parent=course, category="sequential", display_name=f"Section {i}")
|
||||
# get updated course
|
||||
self.course = self.store.get_item(course.location)
|
||||
|
||||
@@ -43,7 +43,7 @@ class SelfPacedDueDatesTests(ModuleStoreTestCase): # lint-amnesty, pylint: disa
|
||||
|
||||
def test_hidden_sections(self):
|
||||
for _ in range(2):
|
||||
ItemFactory(parent=self.course, category="sequential", visible_to_staff_only=True)
|
||||
BlockFactory(parent=self.course, category="sequential", visible_to_staff_only=True)
|
||||
expected_sections = [
|
||||
(0, 'Section 0', timedelta(days=7)),
|
||||
(1, 'Section 1', timedelta(days=14)),
|
||||
@@ -61,14 +61,14 @@ class SelfPacedDueDatesTests(ModuleStoreTestCase): # lint-amnesty, pylint: disa
|
||||
children leaf nodes include an assignment that is graded and scored
|
||||
"""
|
||||
with self.store.bulk_operations(self.course.id):
|
||||
sequence = ItemFactory(parent=self.course, category="sequential")
|
||||
vertical = ItemFactory(parent=sequence, category="vertical")
|
||||
sequence = BlockFactory(parent=self.course, category="sequential")
|
||||
vertical = BlockFactory(parent=sequence, category="vertical")
|
||||
|
||||
sequence = self.store.get_item(sequence.location)
|
||||
assert _has_assignment_blocks(sequence) is False
|
||||
|
||||
# Ungraded problems do not count as assignment blocks
|
||||
ItemFactory.create(
|
||||
BlockFactory.create(
|
||||
parent=vertical,
|
||||
category='problem',
|
||||
graded=True,
|
||||
@@ -77,7 +77,7 @@ class SelfPacedDueDatesTests(ModuleStoreTestCase): # lint-amnesty, pylint: disa
|
||||
sequence = self.store.get_item(sequence.location)
|
||||
assert _has_assignment_blocks(sequence) is False
|
||||
|
||||
ItemFactory.create(
|
||||
BlockFactory.create(
|
||||
parent=vertical,
|
||||
category='problem',
|
||||
graded=False,
|
||||
@@ -87,7 +87,7 @@ class SelfPacedDueDatesTests(ModuleStoreTestCase): # lint-amnesty, pylint: disa
|
||||
assert _has_assignment_blocks(sequence) is False
|
||||
|
||||
# Method will return true after adding a graded, scored assignment block
|
||||
ItemFactory.create(
|
||||
BlockFactory.create(
|
||||
parent=vertical,
|
||||
category='problem',
|
||||
graded=True,
|
||||
@@ -102,22 +102,22 @@ class SelfPacedDueDatesTests(ModuleStoreTestCase): # lint-amnesty, pylint: disa
|
||||
even if the block has graded siblings in the sequence
|
||||
"""
|
||||
with self.store.bulk_operations(self.course.id):
|
||||
sequence = ItemFactory(parent=self.course, category="sequential")
|
||||
vertical = ItemFactory(parent=sequence, category="vertical")
|
||||
sequence = BlockFactory(parent=self.course, category="sequential")
|
||||
vertical = BlockFactory(parent=sequence, category="vertical")
|
||||
sequence = self.store.get_item(sequence.location)
|
||||
ItemFactory.create(
|
||||
BlockFactory.create(
|
||||
parent=vertical,
|
||||
category='problem',
|
||||
graded=False,
|
||||
weight=1,
|
||||
)
|
||||
ungraded_problem_2 = ItemFactory.create(
|
||||
ungraded_problem_2 = BlockFactory.create(
|
||||
parent=vertical,
|
||||
category='problem',
|
||||
graded=True,
|
||||
weight=0,
|
||||
)
|
||||
graded_problem_1 = ItemFactory.create(
|
||||
graded_problem_1 = BlockFactory.create(
|
||||
parent=vertical,
|
||||
category='problem',
|
||||
graded=True,
|
||||
@@ -135,20 +135,20 @@ class SelfPacedDueDatesTests(ModuleStoreTestCase): # lint-amnesty, pylint: disa
|
||||
_gather_graded_items should not set a due date for ORA problems
|
||||
"""
|
||||
with self.store.bulk_operations(self.course.id):
|
||||
sequence = ItemFactory(parent=self.course, category="sequential")
|
||||
vertical = ItemFactory(parent=sequence, category="vertical")
|
||||
ItemFactory.create(
|
||||
sequence = BlockFactory(parent=self.course, category="sequential")
|
||||
vertical = BlockFactory(parent=sequence, category="vertical")
|
||||
BlockFactory.create(
|
||||
parent=vertical,
|
||||
category='openassessment',
|
||||
graded=True
|
||||
)
|
||||
ungraded_problem_2 = ItemFactory.create(
|
||||
ungraded_problem_2 = BlockFactory.create(
|
||||
parent=vertical,
|
||||
category='problem',
|
||||
graded=True,
|
||||
weight=0,
|
||||
)
|
||||
graded_problem_1 = ItemFactory.create(
|
||||
graded_problem_1 = BlockFactory.create(
|
||||
parent=vertical,
|
||||
category='problem',
|
||||
graded=True,
|
||||
@@ -168,10 +168,10 @@ class SelfPacedDueDatesTests(ModuleStoreTestCase): # lint-amnesty, pylint: disa
|
||||
"""
|
||||
# A subsection with multiple units but no problems. Units should inherit due date.
|
||||
with self.store.bulk_operations(self.course.id):
|
||||
sequence = ItemFactory(parent=self.course, category='sequential', relative_weeks_due=2)
|
||||
vertical1 = ItemFactory(parent=sequence, category='vertical')
|
||||
vertical2 = ItemFactory(parent=sequence, category='vertical')
|
||||
vertical3 = ItemFactory(parent=sequence, category='vertical')
|
||||
sequence = BlockFactory(parent=self.course, category='sequential', relative_weeks_due=2)
|
||||
vertical1 = BlockFactory(parent=sequence, category='vertical')
|
||||
vertical2 = BlockFactory(parent=sequence, category='vertical')
|
||||
vertical3 = BlockFactory(parent=sequence, category='vertical')
|
||||
expected_dates = [
|
||||
(sequence.location, {'due': timedelta(weeks=2)}),
|
||||
(vertical1.location, {'due': timedelta(weeks=2)}),
|
||||
@@ -184,8 +184,8 @@ class SelfPacedDueDatesTests(ModuleStoreTestCase): # lint-amnesty, pylint: disa
|
||||
with self.store.bulk_operations(self.course.id):
|
||||
# A subsection with multiple units, each of which has a problem.
|
||||
# Problems should also inherit due date.
|
||||
problem1 = ItemFactory(parent=vertical1, category='problem')
|
||||
problem2 = ItemFactory(parent=vertical2, category='problem')
|
||||
problem1 = BlockFactory(parent=vertical1, category='problem')
|
||||
problem2 = BlockFactory(parent=vertical2, category='problem')
|
||||
expected_dates.extend([
|
||||
(problem1.location, {'due': timedelta(weeks=2)}),
|
||||
(problem2.location, {'due': timedelta(weeks=2)})
|
||||
@@ -194,13 +194,13 @@ class SelfPacedDueDatesTests(ModuleStoreTestCase): # lint-amnesty, pylint: disa
|
||||
self.assertCountEqual(_get_custom_pacing_children(sequence, 2), expected_dates)
|
||||
|
||||
# A subsection that has ORA as a problem. ORA should not inherit due date.
|
||||
ItemFactory.create(parent=vertical3, category='openassessment')
|
||||
BlockFactory.create(parent=vertical3, category='openassessment')
|
||||
sequence = self.store.get_item(sequence.location)
|
||||
self.assertCountEqual(_get_custom_pacing_children(sequence, 2), expected_dates)
|
||||
|
||||
# A subsection that has an ORA problem and a non ORA problem. ORA should
|
||||
# not inherit due date, but non ORA problems should.
|
||||
problem3 = ItemFactory(parent=vertical3, category='problem')
|
||||
problem3 = BlockFactory(parent=vertical3, category='problem')
|
||||
expected_dates.append((problem3.location, {'due': timedelta(weeks=2)}))
|
||||
sequence = self.store.get_item(sequence.location)
|
||||
self.assertCountEqual(_get_custom_pacing_children(sequence, 2), expected_dates)
|
||||
@@ -216,7 +216,7 @@ class SelfPacedCustomDueDateTests(ModuleStoreTestCase):
|
||||
super().setUp()
|
||||
SelfPacedRelativeDatesConfig.objects.create(enabled=True)
|
||||
course = CourseFactory.create(self_paced=True)
|
||||
self.chapter = ItemFactory.create(category='chapter', parent=course)
|
||||
self.chapter = BlockFactory.create(category='chapter', parent=course)
|
||||
# get updated course
|
||||
self.course = self.store.get_item(course.location)
|
||||
|
||||
@@ -228,9 +228,9 @@ class SelfPacedCustomDueDateTests(ModuleStoreTestCase):
|
||||
(ex. If a subsection is assigned a due date, its children should also have the same due date)
|
||||
"""
|
||||
with self.store.bulk_operations(self.course.id):
|
||||
sequential = ItemFactory.create(category='sequential', parent=self.chapter, relative_weeks_due=3)
|
||||
vertical = ItemFactory.create(category='vertical', parent=sequential)
|
||||
problem = ItemFactory.create(category='problem', parent=vertical)
|
||||
sequential = BlockFactory.create(category='sequential', parent=self.chapter, relative_weeks_due=3)
|
||||
vertical = BlockFactory.create(category='vertical', parent=sequential)
|
||||
problem = BlockFactory.create(category='problem', parent=vertical)
|
||||
expected_dates = [
|
||||
(self.course.location, {}),
|
||||
(self.chapter.location, {'due': timedelta(days=21)}),
|
||||
@@ -251,9 +251,9 @@ class SelfPacedCustomDueDateTests(ModuleStoreTestCase):
|
||||
PLS logic of evenly spaced sections.
|
||||
"""
|
||||
with self.store.bulk_operations(self.course.id):
|
||||
sequential = ItemFactory.create(category='sequential', parent=self.chapter, relative_weeks_due=3)
|
||||
ItemFactory.create(category='sequential', parent=self.chapter)
|
||||
ItemFactory.create(category='sequential', parent=self.chapter)
|
||||
sequential = BlockFactory.create(category='sequential', parent=self.chapter, relative_weeks_due=3)
|
||||
BlockFactory.create(category='sequential', parent=self.chapter)
|
||||
BlockFactory.create(category='sequential', parent=self.chapter)
|
||||
expected_dates = [
|
||||
(self.course.location, {}),
|
||||
(self.chapter.location, {'due': timedelta(days=28)}),
|
||||
@@ -272,14 +272,14 @@ class SelfPacedCustomDueDateTests(ModuleStoreTestCase):
|
||||
PLS logic of evenly spaced sections.
|
||||
"""
|
||||
with self.store.bulk_operations(self.course.id):
|
||||
sequential1 = ItemFactory.create(category='sequential', parent=self.chapter, relative_weeks_due=2)
|
||||
vertical1 = ItemFactory.create(category='vertical', parent=sequential1)
|
||||
problem1 = ItemFactory.create(category='problem', parent=vertical1)
|
||||
sequential1 = BlockFactory.create(category='sequential', parent=self.chapter, relative_weeks_due=2)
|
||||
vertical1 = BlockFactory.create(category='vertical', parent=sequential1)
|
||||
problem1 = BlockFactory.create(category='problem', parent=vertical1)
|
||||
|
||||
chapter2 = ItemFactory.create(category='chapter', parent=self.course)
|
||||
sequential2 = ItemFactory.create(category='sequential', parent=chapter2, graded=True)
|
||||
vertical2 = ItemFactory.create(category='vertical', parent=sequential2)
|
||||
problem2 = ItemFactory.create(category='problem', parent=vertical2)
|
||||
chapter2 = BlockFactory.create(category='chapter', parent=self.course)
|
||||
sequential2 = BlockFactory.create(category='sequential', parent=chapter2, graded=True)
|
||||
vertical2 = BlockFactory.create(category='vertical', parent=sequential2)
|
||||
problem2 = BlockFactory.create(category='problem', parent=vertical2)
|
||||
|
||||
expected_dates = [
|
||||
(self.course.location, {}),
|
||||
@@ -306,9 +306,9 @@ class SelfPacedCustomDueDateTests(ModuleStoreTestCase):
|
||||
PLS logic of evenly spaced sections.
|
||||
"""
|
||||
with self.store.bulk_operations(self.course.id):
|
||||
sequential1 = ItemFactory.create(category='sequential', parent=self.chapter, relative_weeks_due=4)
|
||||
vertical1 = ItemFactory.create(category='vertical', parent=sequential1)
|
||||
problem1 = ItemFactory.create(category='problem', parent=vertical1)
|
||||
sequential1 = BlockFactory.create(category='sequential', parent=self.chapter, relative_weeks_due=4)
|
||||
vertical1 = BlockFactory.create(category='vertical', parent=sequential1)
|
||||
problem1 = BlockFactory.create(category='problem', parent=vertical1)
|
||||
|
||||
expected_dates = [
|
||||
(self.course.location, {}),
|
||||
@@ -320,11 +320,11 @@ class SelfPacedCustomDueDateTests(ModuleStoreTestCase):
|
||||
|
||||
for i in range(3):
|
||||
course = self.store.get_item(self.course.location)
|
||||
chapter = ItemFactory.create(category='chapter', parent=course)
|
||||
chapter = BlockFactory.create(category='chapter', parent=course)
|
||||
with self.store.bulk_operations(self.course.id):
|
||||
sequential = ItemFactory.create(category='sequential', parent=chapter, graded=True)
|
||||
vertical = ItemFactory.create(category='vertical', parent=sequential)
|
||||
problem = ItemFactory.create(category='problem', parent=vertical)
|
||||
sequential = BlockFactory.create(category='sequential', parent=chapter, graded=True)
|
||||
vertical = BlockFactory.create(category='vertical', parent=sequential)
|
||||
problem = BlockFactory.create(category='problem', parent=vertical)
|
||||
num_days = i * 14 + 28
|
||||
expected_dates.extend([
|
||||
(chapter.location, {'due': timedelta(days=num_days)}),
|
||||
@@ -344,10 +344,10 @@ class SelfPacedCustomDueDateTests(ModuleStoreTestCase):
|
||||
have their corresponding due dates.
|
||||
"""
|
||||
with self.store.bulk_operations(self.course.id):
|
||||
chapter = ItemFactory.create(category='chapter', parent=self.course)
|
||||
sequential1 = ItemFactory.create(category='sequential', parent=chapter, relative_weeks_due=3)
|
||||
sequential2 = ItemFactory.create(category='sequential', parent=chapter, relative_weeks_due=4)
|
||||
sequential3 = ItemFactory.create(category='sequential', parent=chapter, relative_weeks_due=5)
|
||||
chapter = BlockFactory.create(category='chapter', parent=self.course)
|
||||
sequential1 = BlockFactory.create(category='sequential', parent=chapter, relative_weeks_due=3)
|
||||
sequential2 = BlockFactory.create(category='sequential', parent=chapter, relative_weeks_due=4)
|
||||
sequential3 = BlockFactory.create(category='sequential', parent=chapter, relative_weeks_due=5)
|
||||
expected_dates = [
|
||||
(self.course.location, {}),
|
||||
(chapter.location, {'due': timedelta(days=35)}),
|
||||
@@ -366,7 +366,7 @@ class SelfPacedCustomDueDateTests(ModuleStoreTestCase):
|
||||
"""
|
||||
with self.store.bulk_operations(self.course.id):
|
||||
for _ in range(3):
|
||||
ItemFactory.create(category='sequential', parent=self.chapter)
|
||||
BlockFactory.create(category='sequential', parent=self.chapter)
|
||||
expected_dates = [(self.course.location, {})]
|
||||
course = self.store.get_item(self.course.location)
|
||||
self.assertCountEqual(extract_dates_from_course(course), expected_dates)
|
||||
|
||||
@@ -9,7 +9,7 @@ from django.views.decorators.csrf import csrf_exempt
|
||||
from django.views.decorators.http import require_POST
|
||||
from opaque_keys.edx.keys import CourseKey, UsageKey
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreIsolationMixin
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory, ToyCourseFactory
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, BlockFactory, ToyCourseFactory
|
||||
|
||||
from common.djangoapps.course_modes.models import CourseMode
|
||||
from common.djangoapps.course_modes.tests.factories import CourseModeFactory
|
||||
@@ -90,19 +90,19 @@ class ProviderState(ModuleStoreIsolationMixin):
|
||||
enrollment_start=datetime(2020, 1, 1, 1, 1, 1),
|
||||
enrollment_end=datetime(2028, 1, 1, 1, 1, 1),
|
||||
)
|
||||
section = ItemFactory.create(
|
||||
section = BlockFactory.create(
|
||||
parent=demo_course,
|
||||
category="chapter",
|
||||
display_name="Example Week 1: Getting Started"
|
||||
)
|
||||
subsection = ItemFactory.create(
|
||||
subsection = BlockFactory.create(
|
||||
location=UsageKey.from_string('block-v1:edX+DemoX+Demo_Course+type@sequential+block@basic_questions'),
|
||||
parent=section,
|
||||
category="sequential",
|
||||
display_name="Homework - Question Styles",
|
||||
metadata={'graded': True, 'format': 'Homework'}
|
||||
)
|
||||
ItemFactory.create(
|
||||
BlockFactory.create(
|
||||
location=UsageKey.from_string(
|
||||
'block-v1:edX+DemoX+Demo_Course+type@vertical+block@2152d4a4aadc4cb0af5256394a3d1fc7'
|
||||
),
|
||||
|
||||
@@ -18,7 +18,7 @@ from edx_toggles.toggles.testutils import override_waffle_flag
|
||||
from xmodule.data import CertificatesDisplayBehaviors
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import ItemFactory, ToyCourseFactory
|
||||
from xmodule.modulestore.tests.factories import BlockFactory, ToyCourseFactory
|
||||
from xmodule.partitions.partitions import ENROLLMENT_TRACK_PARTITION_ID
|
||||
|
||||
from common.djangoapps.course_modes.models import CourseMode
|
||||
@@ -68,9 +68,9 @@ class BaseCoursewareTests(SharedModuleStoreTestCase):
|
||||
certificate_available_date=_NEXT_WEEK,
|
||||
certificates_display_behavior=CertificatesDisplayBehaviors.END_WITH_DATE
|
||||
)
|
||||
cls.chapter = ItemFactory(parent=cls.course, category='chapter')
|
||||
cls.sequence = ItemFactory(parent=cls.chapter, category='sequential', display_name='sequence')
|
||||
cls.unit = ItemFactory.create(parent=cls.sequence, category='vertical', display_name="Vertical")
|
||||
cls.chapter = BlockFactory(parent=cls.course, category='chapter')
|
||||
cls.sequence = BlockFactory(parent=cls.chapter, category='sequential', display_name='sequence')
|
||||
cls.unit = BlockFactory.create(parent=cls.sequence, category='vertical', display_name="Vertical")
|
||||
|
||||
cls.user = UserFactory(
|
||||
username='student',
|
||||
@@ -467,7 +467,7 @@ class SequenceApiTestViews(MasqueradeMixin, BaseCoursewareTests):
|
||||
def test_hidden_after_due(self, is_past_due, masquerade_config, expected_hidden, expected_banner):
|
||||
"""Validate the metadata when hide-after-due is set for a sequence"""
|
||||
due = datetime.now() + timedelta(days=-1 if is_past_due else 1)
|
||||
sequence = ItemFactory(
|
||||
sequence = BlockFactory(
|
||||
parent_location=self.chapter.location,
|
||||
# ^ It is very important that we use parent_location=self.chapter.location (and not parent=self.chapter), as
|
||||
# chapter is a class attribute and passing it by value will update its .children=[] which will then leak
|
||||
|
||||
@@ -13,7 +13,7 @@ from openedx.core.djangoapps.credit.exceptions import InvalidCreditRequirements
|
||||
from openedx.core.djangoapps.credit.models import CreditCourse
|
||||
from openedx.core.djangoapps.credit.signals import on_course_publish
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase # lint-amnesty, pylint: disable=wrong-import-order
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory # lint-amnesty, pylint: disable=wrong-import-order
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, BlockFactory # lint-amnesty, pylint: disable=wrong-import-order
|
||||
|
||||
|
||||
class TestTaskExecution(ModuleStoreTestCase):
|
||||
@@ -35,9 +35,10 @@ class TestTaskExecution(ModuleStoreTestCase):
|
||||
super().setUp()
|
||||
|
||||
self.course = CourseFactory.create(start=datetime(2015, 3, 1))
|
||||
self.section = ItemFactory.create(parent=self.course, category='chapter', display_name='Test Section')
|
||||
self.subsection = ItemFactory.create(parent=self.section, category='sequential', display_name='Test Subsection')
|
||||
self.vertical = ItemFactory.create(parent=self.subsection, category='vertical', display_name='Test Unit')
|
||||
self.section = BlockFactory.create(parent=self.course, category='chapter', display_name='Test Section')
|
||||
self.subsection = BlockFactory.create(
|
||||
parent=self.section, category='sequential', display_name='Test Subsection')
|
||||
self.vertical = BlockFactory.create(parent=self.subsection, category='vertical', display_name='Test Unit')
|
||||
|
||||
def test_task_adding_requirements_invalid_course(self):
|
||||
"""
|
||||
@@ -182,7 +183,7 @@ class TestTaskExecution(ModuleStoreTestCase):
|
||||
"""
|
||||
|
||||
self.add_credit_course(self.course.id)
|
||||
subsection = ItemFactory.create(parent=self.section, category='sequential', display_name='Dummy Subsection')
|
||||
subsection = BlockFactory.create(parent=self.section, category='sequential', display_name='Dummy Subsection')
|
||||
create_exam(
|
||||
course_id=str(self.course.id),
|
||||
content_id=str(subsection.location),
|
||||
|
||||
@@ -13,7 +13,7 @@ from openedx.core.djangoapps.discussions.tasks import (
|
||||
update_unit_discussion_state_from_discussion_blocks,
|
||||
)
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, BlockFactory
|
||||
|
||||
|
||||
class DiscussionConfigUpdateMixin:
|
||||
@@ -69,46 +69,46 @@ class UpdateDiscussionsSettingsFromCourseTestCase(ModuleStoreTestCase, Discussio
|
||||
)
|
||||
self.course_key = course_key = self.course.id
|
||||
with self.store.bulk_operations(course_key):
|
||||
self.section = ItemFactory.create(parent=course, category="chapter", display_name="Section")
|
||||
self.sequence = ItemFactory.create(parent=self.section, category="sequential", display_name="Sequence")
|
||||
self.unit = ItemFactory.create(parent=self.sequence, category="vertical", display_name="Unit")
|
||||
ItemFactory.create(
|
||||
self.section = BlockFactory.create(parent=course, category="chapter", display_name="Section")
|
||||
self.sequence = BlockFactory.create(parent=self.section, category="sequential", display_name="Sequence")
|
||||
self.unit = BlockFactory.create(parent=self.sequence, category="vertical", display_name="Unit")
|
||||
BlockFactory.create(
|
||||
parent=self.sequence,
|
||||
category="vertical",
|
||||
display_name="Discussable Unit",
|
||||
discussion_enabled=True,
|
||||
)
|
||||
ItemFactory.create(
|
||||
BlockFactory.create(
|
||||
parent=self.sequence,
|
||||
category="vertical",
|
||||
display_name="Non-Discussable Unit",
|
||||
discussion_enabled=False,
|
||||
)
|
||||
ItemFactory.create(parent=self.unit, category="html", display_name="An HTML Block")
|
||||
graded_sequence = ItemFactory.create(
|
||||
BlockFactory.create(parent=self.unit, category="html", display_name="An HTML Block")
|
||||
graded_sequence = BlockFactory.create(
|
||||
parent=self.section,
|
||||
category="sequential",
|
||||
display_name="Graded Sequence",
|
||||
graded=True,
|
||||
)
|
||||
graded_unit = ItemFactory.create(
|
||||
graded_unit = BlockFactory.create(
|
||||
parent=graded_sequence,
|
||||
category="vertical",
|
||||
display_name="Graded Unit",
|
||||
)
|
||||
ItemFactory.create(
|
||||
BlockFactory.create(
|
||||
parent=graded_sequence,
|
||||
category="vertical",
|
||||
display_name="Discussable Graded Unit",
|
||||
discussion_enabled=True,
|
||||
)
|
||||
ItemFactory.create(
|
||||
BlockFactory.create(
|
||||
parent=graded_sequence,
|
||||
category="vertical",
|
||||
display_name="Non-Discussable Graded Unit",
|
||||
discussion_enabled=False,
|
||||
)
|
||||
ItemFactory.create(
|
||||
BlockFactory.create(
|
||||
parent=graded_unit,
|
||||
category="html",
|
||||
display_name="Graded HTML Block",
|
||||
@@ -195,35 +195,35 @@ class MigrateUnitDiscussionStateFromXBlockTestCase(ModuleStoreTestCase, Discussi
|
||||
self.course = course = CourseFactory.create()
|
||||
self.course_key = course_key = self.course.id
|
||||
with self.store.bulk_operations(course_key):
|
||||
section = ItemFactory.create(
|
||||
section = BlockFactory.create(
|
||||
parent=course, category="chapter", display_name="Section"
|
||||
)
|
||||
sequence = ItemFactory.create(
|
||||
sequence = BlockFactory.create(
|
||||
parent=section, category="sequential", display_name="Sequence"
|
||||
)
|
||||
self.unit_discussible = unit_discussible = ItemFactory.create(
|
||||
self.unit_discussible = unit_discussible = BlockFactory.create(
|
||||
parent=sequence,
|
||||
category="vertical",
|
||||
display_name="Discussable Unit",
|
||||
)
|
||||
unit_non_discussible = ItemFactory.create(
|
||||
unit_non_discussible = BlockFactory.create(
|
||||
parent=sequence,
|
||||
category="vertical",
|
||||
display_name="Non-Discussable Unit",
|
||||
discussion_enabled=False,
|
||||
)
|
||||
graded_sequence = ItemFactory.create(
|
||||
graded_sequence = BlockFactory.create(
|
||||
parent=section,
|
||||
category="sequential",
|
||||
display_name="Graded Sequence",
|
||||
graded=True,
|
||||
)
|
||||
self.graded_unit_discussible = graded_unit_discussible = ItemFactory.create(
|
||||
self.graded_unit_discussible = graded_unit_discussible = BlockFactory.create(
|
||||
parent=graded_sequence,
|
||||
category="vertical",
|
||||
display_name="Discussable Graded Unit",
|
||||
)
|
||||
graded_unit_non_discussible = ItemFactory.create(
|
||||
graded_unit_non_discussible = BlockFactory.create(
|
||||
parent=graded_sequence,
|
||||
category="vertical",
|
||||
display_name="Non-Discussable Graded Unit",
|
||||
@@ -243,7 +243,7 @@ class MigrateUnitDiscussionStateFromXBlockTestCase(ModuleStoreTestCase, Discussi
|
||||
Add a discussion block to the specified units.
|
||||
"""
|
||||
for unit in units:
|
||||
ItemFactory.create(
|
||||
BlockFactory.create(
|
||||
parent=unit,
|
||||
category='discussion',
|
||||
discussion_id=f'id-{unit.location}',
|
||||
|
||||
@@ -3,7 +3,7 @@ Tests for discussions course block transformer
|
||||
"""
|
||||
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, BlockFactory
|
||||
|
||||
from lms.djangoapps.course_blocks.api import get_course_blocks
|
||||
from lms.djangoapps.course_blocks.transformers.tests.helpers import TransformerRegistryTestMixin
|
||||
@@ -24,15 +24,15 @@ class DiscussionsTopicLinkTransformerTestCase(TransformerRegistryTestMixin, Modu
|
||||
super().setUp()
|
||||
self.test_topic_id = 'test-topic-id'
|
||||
self.course = CourseFactory.create()
|
||||
section = ItemFactory.create(
|
||||
section = BlockFactory.create(
|
||||
parent_location=self.course.location,
|
||||
category="chapter",
|
||||
)
|
||||
subsection1 = ItemFactory.create(
|
||||
subsection1 = BlockFactory.create(
|
||||
parent_location=section.location,
|
||||
category="sequential",
|
||||
)
|
||||
self.discussable_unit = ItemFactory.create(
|
||||
self.discussable_unit = BlockFactory.create(
|
||||
parent_location=subsection1.location,
|
||||
category="vertical",
|
||||
# This won't really be used, but set it anyway
|
||||
@@ -45,7 +45,7 @@ class DiscussionsTopicLinkTransformerTestCase(TransformerRegistryTestMixin, Modu
|
||||
provider_id=get_default_provider_type(),
|
||||
external_id=self.test_topic_id,
|
||||
)
|
||||
self.non_discussable_unit = ItemFactory.create(
|
||||
self.non_discussable_unit = BlockFactory.create(
|
||||
parent_location=subsection1.location,
|
||||
category="vertical",
|
||||
discussion_enabled=False,
|
||||
|
||||
@@ -22,7 +22,7 @@ from openedx.core.djangoapps.schedules.models import ScheduleExperience
|
||||
from openedx.core.djangolib.testing.utils import skip_unless_lms
|
||||
from common.djangoapps.student.tests.factories import CourseEnrollmentFactory
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase # lint-amnesty, pylint: disable=wrong-import-order
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory # lint-amnesty, pylint: disable=wrong-import-order
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, BlockFactory # lint-amnesty, pylint: disable=wrong-import-order
|
||||
|
||||
|
||||
@ddt.ddt
|
||||
@@ -65,7 +65,7 @@ class TestSendCourseUpdate(ScheduleUpsellTestMixin, ScheduleSendEmailTestMixin,
|
||||
|
||||
course = CourseFactory(highlights_enabled_for_messaging=True, self_paced=is_self_paced)
|
||||
with self.store.bulk_operations(course.id):
|
||||
ItemFactory.create(parent=course, category='chapter', highlights=['highlights'])
|
||||
BlockFactory.create(parent=course, category='chapter', highlights=['highlights'])
|
||||
|
||||
enrollment = CourseEnrollmentFactory(course_id=course.id, user=self.user, mode='audit')
|
||||
assert enrollment.schedule.get_experience_type() == ScheduleExperience.EXPERIENCES.course_updates
|
||||
|
||||
@@ -4,7 +4,7 @@ from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, BlockFactory
|
||||
|
||||
from openedx.core.djangoapps.schedules.content_highlights import (
|
||||
course_has_highlights_from_store,
|
||||
@@ -36,7 +36,7 @@ class TestContentHighlights(ModuleStoreTestCase): # lint-amnesty, pylint: disab
|
||||
CourseEnrollment.enroll(self.user, self.course_key)
|
||||
|
||||
def _create_chapter(self, **kwargs):
|
||||
ItemFactory.create(
|
||||
BlockFactory.create(
|
||||
parent=self.course,
|
||||
category='chapter',
|
||||
**kwargs
|
||||
|
||||
@@ -15,7 +15,7 @@ from django.test.utils import override_settings
|
||||
from edx_toggles.toggles.testutils import override_waffle_switch
|
||||
from testfixtures import LogCapture
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, BlockFactory
|
||||
|
||||
from common.djangoapps.student.models import CourseEnrollment
|
||||
from common.djangoapps.student.tests.factories import CourseEnrollmentFactory, UserFactory
|
||||
@@ -144,7 +144,7 @@ class TestCourseUpdateResolver(SchedulesResolverTestMixin, ModuleStoreTestCase):
|
||||
super().setUp()
|
||||
self.course = CourseFactory.create(highlights_enabled_for_messaging=True)
|
||||
with self.store.bulk_operations(self.course.id):
|
||||
ItemFactory.create(parent=self.course, category='chapter', highlights=['good stuff'])
|
||||
BlockFactory.create(parent=self.course, category='chapter', highlights=['good stuff'])
|
||||
|
||||
def create_resolver(self):
|
||||
"""
|
||||
@@ -244,10 +244,10 @@ class TestCourseNextSectionUpdateResolver(SchedulesResolverTestMixin, ModuleStor
|
||||
)
|
||||
|
||||
with self.store.bulk_operations(self.course.id):
|
||||
ItemFactory.create(parent=self.course, category='chapter', highlights=['good stuff 1'])
|
||||
ItemFactory.create(parent=self.course, category='chapter', highlights=['good stuff 2'])
|
||||
ItemFactory.create(parent=self.course, category='chapter', highlights=['good stuff 3'])
|
||||
ItemFactory.create(parent=self.course, category='chapter', highlights=['good stuff 4'])
|
||||
BlockFactory.create(parent=self.course, category='chapter', highlights=['good stuff 1'])
|
||||
BlockFactory.create(parent=self.course, category='chapter', highlights=['good stuff 2'])
|
||||
BlockFactory.create(parent=self.course, category='chapter', highlights=['good stuff 3'])
|
||||
BlockFactory.create(parent=self.course, category='chapter', highlights=['good stuff 4'])
|
||||
|
||||
def create_resolver(self, user_start_date_offset=8):
|
||||
"""
|
||||
|
||||
@@ -12,7 +12,7 @@ from openedx.core.djangolib.testing.utils import skip_unless_lms
|
||||
from common.djangoapps.student.models import CourseEnrollment
|
||||
from common.djangoapps.student.tests.factories import UserFactory
|
||||
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase # lint-amnesty, pylint: disable=wrong-import-order
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory # lint-amnesty, pylint: disable=wrong-import-order
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, BlockFactory # lint-amnesty, pylint: disable=wrong-import-order
|
||||
|
||||
from ..utils import format_social_link, validate_social_link
|
||||
|
||||
@@ -84,10 +84,10 @@ class CompletionUtilsTestCase(SharedModuleStoreTestCase, CompletionWaffleTestMix
|
||||
"""
|
||||
course = CourseFactory.create()
|
||||
with self.store.bulk_operations(course.id):
|
||||
self.chapter = ItemFactory.create(category='chapter', parent=course)
|
||||
self.sequential = ItemFactory.create(category='sequential', parent=self.chapter)
|
||||
self.vertical1 = ItemFactory.create(category='vertical', parent=self.sequential)
|
||||
self.vertical2 = ItemFactory.create(category='vertical', parent=self.sequential)
|
||||
self.chapter = BlockFactory.create(category='chapter', parent=course)
|
||||
self.sequential = BlockFactory.create(category='sequential', parent=self.chapter)
|
||||
self.vertical1 = BlockFactory.create(category='vertical', parent=self.sequential)
|
||||
self.vertical2 = BlockFactory.create(category='vertical', parent=self.sequential)
|
||||
|
||||
if hasattr(self, 'user_one'):
|
||||
CourseEnrollment.enroll(self.engaged_user, course.id)
|
||||
|
||||
@@ -13,7 +13,7 @@ from openedx.core.djangoapps.user_api.tests.factories import UserCourseTagFactor
|
||||
from openedx.core.lib.teams_config import TeamsConfig
|
||||
from common.djangoapps.student.tests.factories import CourseEnrollmentFactory, UserFactory
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase # lint-amnesty, pylint: disable=wrong-import-order
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory # lint-amnesty, pylint: disable=wrong-import-order
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, BlockFactory # lint-amnesty, pylint: disable=wrong-import-order
|
||||
from xmodule.partitions.partitions import Group, UserPartition # lint-amnesty, pylint: disable=wrong-import-order
|
||||
|
||||
|
||||
@@ -99,21 +99,21 @@ class ContentGroupTestCase(ModuleStoreTestCase):
|
||||
partition_id=self.course.user_partitions[0].id,
|
||||
group_id=self.course.user_partitions[0].groups[1].id
|
||||
)
|
||||
self.alpha_module = ItemFactory.create(
|
||||
self.alpha_module = BlockFactory.create(
|
||||
parent_location=self.course.location,
|
||||
category='discussion',
|
||||
discussion_id='alpha_group_discussion',
|
||||
discussion_target='Visible to Alpha',
|
||||
group_access={self.course.user_partitions[0].id: [self.course.user_partitions[0].groups[0].id]}
|
||||
)
|
||||
self.beta_module = ItemFactory.create(
|
||||
self.beta_module = BlockFactory.create(
|
||||
parent_location=self.course.location,
|
||||
category='discussion',
|
||||
discussion_id='beta_group_discussion',
|
||||
discussion_target='Visible to Beta',
|
||||
group_access={self.course.user_partitions[0].id: [self.course.user_partitions[0].groups[1].id]}
|
||||
)
|
||||
self.global_module = ItemFactory.create(
|
||||
self.global_module = BlockFactory.create(
|
||||
parent_location=self.course.location,
|
||||
category='discussion',
|
||||
discussion_id='global_group_discussion',
|
||||
@@ -172,14 +172,14 @@ class TestConditionalContent(ModuleStoreTestCase):
|
||||
}]
|
||||
}
|
||||
)
|
||||
chapter = ItemFactory.create(parent_location=self.course.location,
|
||||
display_name='Chapter')
|
||||
chapter = BlockFactory.create(parent_location=self.course.location,
|
||||
display_name='Chapter')
|
||||
|
||||
# add a sequence to the course to which the problems can be added
|
||||
self.problem_section = ItemFactory.create(parent_location=chapter.location,
|
||||
category='sequential',
|
||||
metadata={'graded': True, 'format': 'Homework'},
|
||||
display_name=self.TEST_SECTION_NAME)
|
||||
self.problem_section = BlockFactory.create(parent_location=chapter.location,
|
||||
category='sequential',
|
||||
metadata={'graded': True, 'format': 'Homework'},
|
||||
display_name=self.TEST_SECTION_NAME)
|
||||
|
||||
# Create users and partition them
|
||||
self.student_a = UserFactory.create(username='student_a', email='student_a@example.com')
|
||||
@@ -201,7 +201,7 @@ class TestConditionalContent(ModuleStoreTestCase):
|
||||
)
|
||||
|
||||
# Create a vertical to contain our split test
|
||||
problem_vertical = ItemFactory.create(
|
||||
problem_vertical = BlockFactory.create(
|
||||
parent_location=self.problem_section.location,
|
||||
category='vertical',
|
||||
display_name='Problem Unit'
|
||||
@@ -210,20 +210,20 @@ class TestConditionalContent(ModuleStoreTestCase):
|
||||
# Create the split test and child vertical containers
|
||||
vertical_a_url = self.course.id.make_usage_key('vertical', 'split_test_vertical_a')
|
||||
vertical_b_url = self.course.id.make_usage_key('vertical', 'split_test_vertical_b')
|
||||
self.split_test = ItemFactory.create(
|
||||
self.split_test = BlockFactory.create(
|
||||
parent_location=problem_vertical.location,
|
||||
category='split_test',
|
||||
display_name='Split Test',
|
||||
user_partition_id=self.partition.id,
|
||||
group_id_to_child={str(index): url for index, url in enumerate([vertical_a_url, vertical_b_url])}
|
||||
)
|
||||
self.vertical_a = ItemFactory.create(
|
||||
self.vertical_a = BlockFactory.create(
|
||||
parent_location=self.split_test.location,
|
||||
category='vertical',
|
||||
display_name='Group A problem container',
|
||||
location=vertical_a_url
|
||||
)
|
||||
self.vertical_b = ItemFactory.create(
|
||||
self.vertical_b = BlockFactory.create(
|
||||
parent_location=self.split_test.location,
|
||||
category='vertical',
|
||||
display_name='Group B problem container',
|
||||
|
||||
@@ -12,7 +12,7 @@ from django.conf import settings
|
||||
from milestones import api as milestones_api
|
||||
from milestones.tests.utils import MilestonesTestCaseMixin
|
||||
from xmodule.modulestore.tests.django_utils import TEST_DATA_SPLIT_MODULESTORE, ModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, BlockFactory
|
||||
|
||||
from common.djangoapps.student.tests.factories import UserFactory
|
||||
from lms.djangoapps.gating import api as lms_gating_api
|
||||
@@ -46,26 +46,26 @@ class TestGatingApi(ModuleStoreTestCase, MilestonesTestCaseMixin):
|
||||
self.course.save()
|
||||
|
||||
# create chapter
|
||||
self.chapter1 = ItemFactory.create(
|
||||
self.chapter1 = BlockFactory.create(
|
||||
parent_location=self.course.location,
|
||||
category='chapter',
|
||||
display_name='untitled chapter 1'
|
||||
)
|
||||
|
||||
# create sequentials
|
||||
self.seq1 = ItemFactory.create(
|
||||
self.seq1 = BlockFactory.create(
|
||||
parent_location=self.chapter1.location,
|
||||
category='sequential',
|
||||
display_name='untitled sequential 1'
|
||||
)
|
||||
self.seq2 = ItemFactory.create(
|
||||
self.seq2 = BlockFactory.create(
|
||||
parent_location=self.chapter1.location,
|
||||
category='sequential',
|
||||
display_name='untitled sequential 2'
|
||||
)
|
||||
|
||||
# create vertical
|
||||
self.vertical = ItemFactory.create(
|
||||
self.vertical = BlockFactory.create(
|
||||
parent_location=self.seq1.location,
|
||||
category='vertical',
|
||||
display_name='untitled vertical 1'
|
||||
@@ -248,12 +248,12 @@ class TestGatingApi(ModuleStoreTestCase, MilestonesTestCaseMixin):
|
||||
|
||||
"""
|
||||
student = UserFactory(is_staff=False)
|
||||
problem_block = ItemFactory.create(
|
||||
problem_block = BlockFactory.create(
|
||||
parent_location=self.vertical.location,
|
||||
category='problem',
|
||||
display_name='some problem'
|
||||
)
|
||||
html_block = ItemFactory.create(
|
||||
html_block = BlockFactory.create(
|
||||
parent_location=self.vertical.location,
|
||||
category='html',
|
||||
display_name='some html block'
|
||||
@@ -293,7 +293,7 @@ class TestGatingApi(ModuleStoreTestCase, MilestonesTestCaseMixin):
|
||||
"""
|
||||
student = UserFactory(is_staff=False)
|
||||
|
||||
component = ItemFactory.create(
|
||||
component = BlockFactory.create(
|
||||
parent_location=self.vertical.location,
|
||||
category=component_type,
|
||||
display_name=f'{component_type} block'
|
||||
|
||||
@@ -14,7 +14,7 @@ from web_fragments.fragment import Fragment
|
||||
from xblock.core import XBlockAside
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.tests.django_utils import TEST_DATA_SPLIT_MODULESTORE, SharedModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, BlockFactory
|
||||
from xmodule.modulestore.tests.test_asides import AsideTestType
|
||||
|
||||
from openedx.core.lib.url_utils import quote_slashes
|
||||
@@ -164,7 +164,7 @@ class TestXBlockAside(SharedModuleStoreTestCase):
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
cls.course = CourseFactory.create()
|
||||
cls.block = ItemFactory.create(parent=cls.course)
|
||||
cls.block = BlockFactory.create(parent=cls.course)
|
||||
cls.aside_v2 = AsideUsageKeyV2(cls.block.scope_ids.usage_id, "aside")
|
||||
cls.aside_v1 = AsideUsageKeyV1(cls.block.scope_ids.usage_id, "aside")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user