refactor: rename ItemFactory to BlockFactory
This commit is contained in:
@@ -511,7 +511,7 @@ class ModuleStoreTestCase(
|
||||
MODULESTORE = mixed_store_config(data_dir, mappings)
|
||||
# ...
|
||||
|
||||
3. Use factories (e.g. `CourseFactory`, `ItemFactory`) to populate
|
||||
3. Use factories (e.g. `CourseFactory`, `BlockFactory`) to populate
|
||||
the modulestore with test data.
|
||||
|
||||
NOTE:
|
||||
|
||||
@@ -279,7 +279,7 @@ class LibraryFactory(XModuleFactory):
|
||||
return new_library
|
||||
|
||||
|
||||
class ItemFactory(XModuleFactory):
|
||||
class BlockFactory(XModuleFactory):
|
||||
"""
|
||||
Factory for XModule items.
|
||||
"""
|
||||
|
||||
@@ -10,7 +10,7 @@ from bson.objectid import ObjectId
|
||||
from opaque_keys.edx.locator import LibraryLocator
|
||||
|
||||
from xmodule.modulestore.exceptions import DuplicateCourseError
|
||||
from xmodule.modulestore.tests.factories import ItemFactory, LibraryFactory, check_mongo_calls
|
||||
from xmodule.modulestore.tests.factories import BlockFactory, LibraryFactory, check_mongo_calls
|
||||
from xmodule.modulestore.tests.utils import MixedSplitTestCase
|
||||
|
||||
|
||||
@@ -80,14 +80,14 @@ class TestLibraries(MixedSplitTestCase):
|
||||
library = LibraryFactory.create(modulestore=self.store)
|
||||
|
||||
# In the library, create a vertical block with a child:
|
||||
vert_block = ItemFactory.create(
|
||||
vert_block = BlockFactory.create(
|
||||
category="vertical",
|
||||
parent_location=library.location,
|
||||
user_id=self.user_id,
|
||||
publish_item=False,
|
||||
modulestore=self.store,
|
||||
)
|
||||
child_block = ItemFactory.create(
|
||||
child_block = BlockFactory.create(
|
||||
category="html",
|
||||
parent_location=vert_block.location,
|
||||
user_id=self.user_id,
|
||||
@@ -103,7 +103,7 @@ class TestLibraries(MixedSplitTestCase):
|
||||
"""
|
||||
library = LibraryFactory.create(modulestore=self.store)
|
||||
|
||||
block = ItemFactory.create(
|
||||
block = BlockFactory.create(
|
||||
category="html",
|
||||
parent_location=library.location,
|
||||
user_id=self.user_id,
|
||||
@@ -128,7 +128,7 @@ class TestLibraries(MixedSplitTestCase):
|
||||
"""
|
||||
library = LibraryFactory.create(modulestore=self.store)
|
||||
lib_key = library.location.library_key
|
||||
block = ItemFactory.create(
|
||||
block = BlockFactory.create(
|
||||
category="html",
|
||||
parent_location=library.location,
|
||||
user_id=self.user_id,
|
||||
@@ -191,7 +191,7 @@ class TestLibraries(MixedSplitTestCase):
|
||||
|
||||
def test_xblock_in_lib_have_published_version_returns_false(self):
|
||||
library = LibraryFactory.create(modulestore=self.store)
|
||||
block = ItemFactory.create(
|
||||
block = BlockFactory.create(
|
||||
category="html",
|
||||
parent_location=library.location,
|
||||
user_id=self.user_id,
|
||||
|
||||
@@ -20,7 +20,7 @@ from openedx.core.lib.tests import attr
|
||||
from xmodule.exceptions import InvalidVersionError
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.exceptions import ItemNotFoundError
|
||||
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.tests.test_split_w_old_mongo import SplitWMongoCourseBootstrapper
|
||||
from xmodule.modulestore.tests.utils import (
|
||||
DRAFT_MODULESTORE_SETUP,
|
||||
@@ -217,7 +217,7 @@ class DraftPublishedOpTestCourseSetup(unittest.TestCase):
|
||||
parent_id = _make_block_id(parent_type, idx // 2)
|
||||
parent_item = getattr(self, parent_id)
|
||||
block_id = _make_block_id(block_type, idx)
|
||||
setattr(self, block_id, ItemFactory.create(
|
||||
setattr(self, block_id, BlockFactory.create(
|
||||
parent_location=parent_item.location,
|
||||
category=block_type,
|
||||
modulestore=store,
|
||||
|
||||
@@ -19,7 +19,7 @@ from xmodule.modulestore.mongo.base import ModuleStoreEnum
|
||||
from xmodule.modulestore.mongo.draft import DraftModuleStore
|
||||
from xmodule.modulestore.split_mongo.split_draft import DraftVersioningModuleStore
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase, TEST_DATA_ONLY_SPLIT_MODULESTORE_DRAFT_PREFERRED
|
||||
from xmodule.modulestore.tests.factories import ItemFactory
|
||||
from xmodule.modulestore.tests.factories import BlockFactory
|
||||
from xmodule.modulestore.tests.mongo_connection import MONGO_HOST, MONGO_PORT_NUM
|
||||
from xmodule.modulestore.xml import XMLModuleStore
|
||||
from xmodule.tests import DATA_DIR
|
||||
@@ -109,7 +109,7 @@ class MixedSplitTestCase(ModuleStoreTestCase):
|
||||
"""
|
||||
extra = {"publish_item": False, "user_id": self.user_id}
|
||||
extra.update(kwargs)
|
||||
return ItemFactory.create(
|
||||
return BlockFactory.create(
|
||||
category=category,
|
||||
parent=parent_block,
|
||||
parent_location=parent_block.location,
|
||||
@@ -135,7 +135,7 @@ class ProceduralCourseTestMixin:
|
||||
|
||||
xblock_type = stack[0]
|
||||
for _ in range(branching):
|
||||
child = ItemFactory.create(
|
||||
child = BlockFactory.create(
|
||||
category=xblock_type,
|
||||
parent=parent,
|
||||
user_id=user_id
|
||||
|
||||
Reference in New Issue
Block a user