Skip to content
22 changes: 11 additions & 11 deletions cms/djangoapps/contentstore/api/tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from django.urls import reverse
from rest_framework.test import APITestCase
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 common.djangoapps.student.tests.factories import StaffFactory
from common.djangoapps.student.tests.factories import UserFactory
Expand Down Expand Up @@ -40,44 +40,44 @@ def initialize_course(cls, course):
course.self_paced = True
cls.store.update_item(course, cls.staff.id)

cls.section = ItemFactory.create(
cls.section = BlockFactory.create(
parent_location=course.location,
category="chapter",
)
cls.subsection1 = ItemFactory.create(
cls.subsection1 = BlockFactory.create(
parent_location=cls.section.location,
category="sequential",
)
unit1 = ItemFactory.create(
unit1 = BlockFactory.create(
parent_location=cls.subsection1.location,
category="vertical",
)
ItemFactory.create(
BlockFactory.create(
parent_location=unit1.location,
category="video",
)
ItemFactory.create(
BlockFactory.create(
parent_location=unit1.location,
category="problem",
)

cls.subsection2 = ItemFactory.create(
cls.subsection2 = BlockFactory.create(
parent_location=cls.section.location,
category="sequential",
)
unit2 = ItemFactory.create(
unit2 = BlockFactory.create(
parent_location=cls.subsection2.location,
category="vertical",
)
unit3 = ItemFactory.create(
unit3 = BlockFactory.create(
parent_location=cls.subsection2.location,
category="vertical",
)
ItemFactory.create(
BlockFactory.create(
parent_location=unit3.location,
category="video",
)
ItemFactory.create(
BlockFactory.create(
parent_location=unit3.location,
category="video",
)
Expand Down
6 changes: 3 additions & 3 deletions cms/djangoapps/contentstore/api/tests/test_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from rest_framework import status
from rest_framework.test import APITestCase
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 common.djangoapps.student.tests.factories import StaffFactory
from common.djangoapps.student.tests.factories import UserFactory
Expand Down Expand Up @@ -57,11 +57,11 @@ def initialize_course(cls, course):
fields=dict(data="<ol><li><h2>Date</h2>Hello world!</li></ol>"),
)

section = ItemFactory.create(
section = BlockFactory.create(
parent_location=course.location,
category="chapter",
)
ItemFactory.create(
BlockFactory.create(
parent_location=section.location,
category="sequential",
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from openedx.core.djangoapps.content.course_overviews.models import CourseOverview
from openedx.core.djangoapps.content.learning_sequences.api import get_course_keys_with_outlines
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 ....outlines import update_outline_from_modulestore

Expand Down Expand Up @@ -53,22 +53,22 @@ def setUpClass(cls):
display_name=f"Outline Backfill Test Course {course_key.run}"
)
with cls.store.bulk_operations(course_key):
section = ItemFactory.create(
section = BlockFactory.create(
parent=course,
category="chapter",
display_name="A Section"
)
sequence = ItemFactory.create(
sequence = BlockFactory.create(
parent=section,
category="sequential",
display_name="A Sequence"
)
unit = ItemFactory.create(
unit = BlockFactory.create(
parent=sequence,
category="vertical",
display_name="A Unit"
)
ItemFactory.create(
BlockFactory.create(
parent=unit,
category="html",
display_name="An HTML Block"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from xmodule.modulestore import ModuleStoreEnum
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 TestFixNotFound(ModuleStoreTestCase):
Expand All @@ -33,7 +33,7 @@ def test_fix_not_found_non_split(self):

def test_fix_not_found(self):
course = CourseFactory.create(default_store=ModuleStoreEnum.Type.split)
ItemFactory.create(category='chapter', parent_location=course.location)
BlockFactory.create(category='chapter', parent_location=course.location)

# get course again in order to update its children list
course = self.store.get_course(course.id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from cms.djangoapps.contentstore.management.commands.utils import get_course_versions
from xmodule.modulestore import ModuleStoreEnum # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase, 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


class TestForcePublish(SharedModuleStoreTestCase):
Expand Down Expand Up @@ -85,7 +85,7 @@ def test_force_publish(self):
Test 'force_publish' command
"""
# Add some changes to course
chapter = ItemFactory.create(category='chapter', parent_location=self.course.location)
chapter = BlockFactory.create(category='chapter', parent_location=self.course.location)
self.store.create_child(
self.test_user_id,
chapter.location,
Expand Down
4 changes: 2 additions & 2 deletions cms/djangoapps/contentstore/rest_api/v0/tests/test_tabs.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import ddt
from django.urls import reverse
from xmodule.modulestore.tests.factories import ItemFactory
from xmodule.modulestore.tests.factories import BlockFactory
from xmodule.tabs import CourseTabList

from cms.djangoapps.contentstore.tests.utils import CourseTestCase
Expand Down Expand Up @@ -43,7 +43,7 @@ def setUp(self):
)

# add a static tab to the course, for code coverage
self.test_tab = ItemFactory.create(
self.test_tab = BlockFactory.create(
parent_location=self.course.location,
category="static_tab",
display_name="Static_1",
Expand Down
19 changes: 10 additions & 9 deletions cms/djangoapps/contentstore/tests/test_contentstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
from xmodule.modulestore.inheritance import own_metadata
from xmodule.modulestore.split_mongo import BlockKey
from xmodule.modulestore.tests.django_utils import TEST_DATA_SPLIT_MODULESTORE
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory, check_mongo_calls
from xmodule.modulestore.tests.factories import CourseFactory, BlockFactory, check_mongo_calls
from xmodule.modulestore.xml_exporter import export_course_to_xml
from xmodule.modulestore.xml_importer import import_course_from_xml, perform_xlint
from xmodule.seq_block import SequenceBlock
Expand Down Expand Up @@ -321,7 +321,7 @@ def test_export_course_with_metadata_only_video(self):

parent = verticals[0]

ItemFactory.create(parent_location=parent.location, category="video", display_name="untitled")
BlockFactory.create(parent_location=parent.location, category="video", display_name="untitled")

root_dir = path(mkdtemp_clean())

Expand All @@ -347,7 +347,7 @@ def test_export_course_with_metadata_only_word_cloud(self):

parent = verticals[0]

ItemFactory.create(parent_location=parent.location, category="word_cloud", display_name="untitled")
BlockFactory.create(parent_location=parent.location, category="word_cloud", display_name="untitled")

root_dir = path(mkdtemp_clean())

Expand Down Expand Up @@ -401,7 +401,8 @@ def test_empty_data_roundtrip(self):
parent = verticals[0]

# Create a module, and ensure that its `data` field is empty
word_cloud = ItemFactory.create(parent_location=parent.location, category="word_cloud", display_name="untitled")
word_cloud = BlockFactory.create(
parent_location=parent.location, category="word_cloud", display_name="untitled")
del word_cloud.data
self.assertEqual(word_cloud.data, '')

Expand Down Expand Up @@ -487,7 +488,7 @@ def test_export_course_no_xml_attributes(self):
vertical = verticals[0]

# create OpenAssessmentBlock:
open_assessment = ItemFactory.create(
open_assessment = BlockFactory.create(
parent_location=vertical.location,
category="openassessment",
display_name="untitled",
Expand Down Expand Up @@ -1362,7 +1363,7 @@ def test_course_factory(self):
def test_item_factory(self):
"""Test that the item factory works correctly."""
course = CourseFactory.create()
item = ItemFactory.create(parent_location=course.location)
item = BlockFactory.create(parent_location=course.location)
self.assertIsInstance(item, SequenceBlock)

def test_course_overview_view_with_course(self):
Expand Down Expand Up @@ -1630,7 +1631,7 @@ def test_metadata_inheritance(self):

def test_default_metadata_inheritance(self):
course = CourseFactory.create()
vertical = ItemFactory.create(parent_location=course.location)
vertical = BlockFactory.create(parent_location=course.location)
course.children.append(vertical)
# in memory
self.assertIsNotNone(course.start)
Expand Down Expand Up @@ -1712,7 +1713,7 @@ def setUp(self):
"""
video_data = VideoBlock.parse_video_xml(video_sample_xml)
video_data.pop('source')
self.video_descriptor = ItemFactory.create(
self.video_descriptor = BlockFactory.create(
parent_location=course.location, category='video',
**video_data
)
Expand Down Expand Up @@ -2046,7 +2047,7 @@ def test_course_license_export(self):
def test_video_license_export(self):
content_store = contentstore()
root_dir = path(mkdtemp_clean())
video_descriptor = ItemFactory.create(
video_descriptor = BlockFactory.create(
parent_location=self.course.location, category='video',
license="all-rights-reserved"
)
Expand Down
Loading