Merge pull request #15170 from edx/jeskew/PLAT_1316_partitions_inheritance
Move fields.py, inheritance.py, and partitions to openedx/core.
This commit is contained in:
@@ -4,13 +4,12 @@ Class for manipulating groups configuration on a course object.
|
||||
import json
|
||||
import logging
|
||||
|
||||
from util.db import generate_int_id, MYSQL_MAX_INT
|
||||
|
||||
from django.utils.translation import ugettext as _
|
||||
from contentstore.utils import reverse_usage_url
|
||||
from django.utils.translation import ugettext as _
|
||||
from openedx.core.djangoapps.course_groups.partition_scheme import get_cohorted_user_partition
|
||||
from xmodule.partitions.partitions import UserPartition, MINIMUM_STATIC_PARTITION_ID
|
||||
from xmodule.partitions.partitions_service import get_all_partitions_for_course
|
||||
from openedx.core.lib.partitions.partitions import MINIMUM_STATIC_PARTITION_ID, UserPartition
|
||||
from openedx.core.lib.partitions.partitions_service import get_all_partitions_for_course
|
||||
from util.db import MYSQL_MAX_INT, generate_int_id
|
||||
from xmodule.split_test_module import get_split_user_partitions
|
||||
|
||||
MINIMUM_GROUP_ID = MINIMUM_STATIC_PARTITION_ID
|
||||
|
||||
@@ -1,35 +1,34 @@
|
||||
"""
|
||||
Tests for Studio Course Settings.
|
||||
"""
|
||||
import datetime
|
||||
import ddt
|
||||
import json
|
||||
import copy
|
||||
import mock
|
||||
from mock import Mock, patch
|
||||
import datetime
|
||||
import json
|
||||
import unittest
|
||||
|
||||
from django.conf import settings
|
||||
from django.utils.timezone import UTC
|
||||
from django.test.utils import override_settings
|
||||
|
||||
import ddt
|
||||
import mock
|
||||
from contentstore.utils import reverse_course_url, reverse_usage_url
|
||||
from django.conf import settings
|
||||
from django.test.utils import override_settings
|
||||
from django.utils.timezone import UTC
|
||||
from milestones.tests.utils import MilestonesTestCaseMixin
|
||||
from mock import Mock, patch
|
||||
from models.settings.course_grading import CourseGradingModel
|
||||
from models.settings.course_metadata import CourseMetadata
|
||||
from models.settings.encoder import CourseSettingsEncoder
|
||||
from openedx.core.djangoapps.self_paced.models import SelfPacedConfiguration
|
||||
from openedx.core.djangoapps.models.course_details import CourseDetails
|
||||
from openedx.core.djangoapps.self_paced.models import SelfPacedConfiguration
|
||||
from openedx.core.lib.xblock_fields.fields import Date
|
||||
from student.roles import CourseInstructorRole, CourseStaffRole
|
||||
from student.tests.factories import UserFactory
|
||||
from xblock_django.models import XBlockStudioConfigurationFlag
|
||||
from xmodule.fields import Date
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.modulestore.tests.factories import CourseFactory
|
||||
from xmodule.tabs import InvalidTabsException
|
||||
from milestones.tests.utils import MilestonesTestCaseMixin
|
||||
|
||||
from .utils import CourseTestCase, AjaxEnabledTestClient
|
||||
from .utils import AjaxEnabledTestClient, CourseTestCase
|
||||
|
||||
|
||||
def get_url(course_id, handler_name='settings_handler'):
|
||||
|
||||
@@ -1,52 +1,52 @@
|
||||
"""
|
||||
Testing indexing of the courseware as it is changed
|
||||
"""
|
||||
import ddt
|
||||
import json
|
||||
from lazy.lazy import lazy
|
||||
import time
|
||||
from datetime import datetime
|
||||
from dateutil.tz import tzutc
|
||||
from mock import patch
|
||||
from pytz import UTC
|
||||
from uuid import uuid4
|
||||
from unittest import skip
|
||||
from uuid import uuid4
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
import ddt
|
||||
from contentstore.courseware_index import (
|
||||
CourseAboutSearchIndexer,
|
||||
CoursewareSearchIndexer,
|
||||
LibrarySearchIndexer,
|
||||
SearchIndexingError
|
||||
)
|
||||
from contentstore.signals.handlers import listen_for_course_publish, listen_for_library_update
|
||||
from contentstore.tests.utils import CourseTestCase
|
||||
from contentstore.utils import reverse_course_url, reverse_usage_url
|
||||
from course_modes.models import CourseMode
|
||||
from dateutil.tz import tzutc
|
||||
from django.conf import settings
|
||||
from lazy.lazy import lazy
|
||||
from mock import patch
|
||||
from openedx.core.djangoapps.models.course_details import CourseDetails
|
||||
from openedx.core.lib.partitions.partitions import UserPartition
|
||||
from openedx.core.lib.xblock_fields.inherited_fields import InheritanceMixin
|
||||
from pytz import UTC
|
||||
from search.search_engine_base import SearchEngine
|
||||
from xmodule.library_tools import normalize_key_for_search
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.django import SignalHandler, modulestore
|
||||
from xmodule.modulestore.edit_info import EditInfoMixin
|
||||
from xmodule.modulestore.inheritance import InheritanceMixin
|
||||
from xmodule.modulestore.mixed import MixedModuleStore
|
||||
from xmodule.modulestore.tests.django_utils import (
|
||||
TEST_DATA_MONGO_MODULESTORE,
|
||||
TEST_DATA_SPLIT_MODULESTORE,
|
||||
SharedModuleStoreTestCase)
|
||||
SharedModuleStoreTestCase
|
||||
)
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory, LibraryFactory
|
||||
from xmodule.modulestore.tests.mongo_connection import MONGO_PORT_NUM, MONGO_HOST
|
||||
from xmodule.modulestore.tests.mongo_connection import MONGO_HOST, MONGO_PORT_NUM
|
||||
from xmodule.modulestore.tests.utils import (
|
||||
create_modulestore_instance, LocationMixin,
|
||||
MixedSplitTestCase, MongoContentstoreBuilder
|
||||
LocationMixin,
|
||||
MixedSplitTestCase,
|
||||
MongoContentstoreBuilder,
|
||||
create_modulestore_instance
|
||||
)
|
||||
from xmodule.tests import DATA_DIR
|
||||
from xmodule.x_module import XModuleMixin
|
||||
from xmodule.partitions.partitions import UserPartition
|
||||
|
||||
from search.search_engine_base import SearchEngine
|
||||
|
||||
from contentstore.courseware_index import (
|
||||
CoursewareSearchIndexer,
|
||||
LibrarySearchIndexer,
|
||||
SearchIndexingError,
|
||||
CourseAboutSearchIndexer,
|
||||
)
|
||||
from contentstore.signals.handlers import listen_for_course_publish, listen_for_library_update
|
||||
from contentstore.utils import reverse_course_url, reverse_usage_url
|
||||
from contentstore.tests.utils import CourseTestCase
|
||||
|
||||
COURSE_CHILD_STRUCTURE = {
|
||||
"course": "chapter",
|
||||
|
||||
@@ -2,19 +2,17 @@
|
||||
import collections
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from pytz import UTC
|
||||
from django.test import TestCase
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase, SharedModuleStoreTestCase
|
||||
from opaque_keys.edx.locations import SlashSeparatedCourseKey
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.partitions.partitions import UserPartition, Group
|
||||
|
||||
from openedx.core.djangoapps.site_configuration.tests.test_util import with_site_configuration_context
|
||||
|
||||
from contentstore import utils
|
||||
from contentstore.tests.utils import CourseTestCase
|
||||
from django.test import TestCase
|
||||
from opaque_keys.edx.locations import SlashSeparatedCourseKey
|
||||
from openedx.core.djangoapps.site_configuration.tests.test_util import with_site_configuration_context
|
||||
from openedx.core.lib.partitions.partitions import Group, UserPartition
|
||||
from pytz import UTC
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase, SharedModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
|
||||
|
||||
|
||||
class LMSLinksTestCase(TestCase):
|
||||
|
||||
@@ -4,26 +4,23 @@ Common utility functions useful throughout the contentstore
|
||||
|
||||
import logging
|
||||
from datetime import datetime
|
||||
from pytz import UTC
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.utils.translation import ugettext as _
|
||||
from django_comment_common.models import assign_default_role
|
||||
from django_comment_common.utils import seed_permissions_roles
|
||||
|
||||
from opaque_keys.edx.keys import CourseKey, UsageKey
|
||||
from openedx.core.djangoapps.self_paced.models import SelfPacedConfiguration
|
||||
from openedx.core.djangoapps.site_configuration.models import SiteConfiguration
|
||||
from xmodule.partitions.partitions_service import get_all_partitions_for_course
|
||||
|
||||
from openedx.core.lib.partitions.partitions_service import get_all_partitions_for_course
|
||||
from pytz import UTC
|
||||
from student import auth
|
||||
from student.models import CourseEnrollment
|
||||
from student.roles import CourseInstructorRole, CourseStaffRole
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.modulestore.exceptions import ItemNotFoundError
|
||||
from opaque_keys.edx.keys import UsageKey, CourseKey
|
||||
from student.roles import CourseInstructorRole, CourseStaffRole
|
||||
from student.models import CourseEnrollment
|
||||
from student import auth
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -70,6 +70,7 @@ from openedx.core.djangoapps.self_paced.models import SelfPacedConfiguration
|
||||
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
|
||||
from openedx.core.lib.course_tabs import CourseTabPluginManager
|
||||
from openedx.core.lib.courses import course_image_url
|
||||
from openedx.core.lib.xblock_fields.inherited_fields import DEFAULT_START_DATE
|
||||
from openedx.core.djangolib.js_utils import dump_js_escaped_json
|
||||
from student import auth
|
||||
from student.auth import has_course_author_access, has_studio_write_access, has_studio_read_access
|
||||
@@ -94,7 +95,6 @@ from util.string_utils import _has_non_ascii_characters
|
||||
from xblock_django.api import deprecated_xblocks
|
||||
from xmodule.contentstore.content import StaticContent
|
||||
from xmodule.course_module import CourseFields
|
||||
from xmodule.course_module import DEFAULT_START_DATE
|
||||
from xmodule.error_module import ErrorDescriptor
|
||||
from xmodule.modulestore import EdxJSONEncoder
|
||||
from xmodule.modulestore.django import modulestore
|
||||
|
||||
@@ -38,16 +38,16 @@ from contentstore.views.helpers import is_unit, xblock_studio_url, xblock_primar
|
||||
from contentstore.views.preview import get_preview_fragment
|
||||
from contentstore.utils import is_self_paced
|
||||
|
||||
from openedx.core.lib.gating import api as gating_api
|
||||
from edxmako.shortcuts import render_to_string
|
||||
from models.settings.course_grading import CourseGradingModel
|
||||
from openedx.core.lib.gating import api as gating_api
|
||||
from openedx.core.lib.xblock_utils import wrap_xblock, request_token
|
||||
from openedx.core.lib.xblock_fields.inherited_fields import DEFAULT_START_DATE
|
||||
from static_replace import replace_static_urls
|
||||
from student.auth import has_studio_write_access, has_studio_read_access
|
||||
from util.date_utils import get_default_time_display
|
||||
from util.json_request import expect_json, JsonResponse
|
||||
from util.milestones_helpers import is_entrance_exams_enabled
|
||||
from xmodule.course_module import DEFAULT_START_DATE
|
||||
from xmodule.modulestore import ModuleStoreEnum, EdxJSONEncoder
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.modulestore.draft_and_published import DIRECT_ONLY_CATEGORIES
|
||||
|
||||
@@ -3,45 +3,45 @@ from __future__ import absolute_import
|
||||
import logging
|
||||
from functools import partial
|
||||
|
||||
import static_replace
|
||||
from cms.lib.xblock.field_data import CmsFieldData
|
||||
from contentstore.utils import get_visibility_partition_info
|
||||
from contentstore.views.access import get_user_role
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.http import Http404, HttpResponseBadRequest
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.utils.translation import ugettext as _
|
||||
from edxmako.shortcuts import render_to_string
|
||||
|
||||
from lms.djangoapps.lms_xblock.field_data import LmsFieldData
|
||||
from opaque_keys.edx.keys import UsageKey
|
||||
from openedx.core.lib.partitions.partitions_service import PartitionService
|
||||
from openedx.core.lib.xblock_utils import (
|
||||
replace_static_urls, wrap_xblock, wrap_fragment, wrap_xblock_aside, request_token, xblock_local_resource_url,
|
||||
replace_static_urls,
|
||||
request_token,
|
||||
wrap_fragment,
|
||||
wrap_xblock,
|
||||
wrap_xblock_aside,
|
||||
xblock_local_resource_url
|
||||
)
|
||||
from xmodule.x_module import PREVIEW_VIEWS, STUDENT_VIEW, AUTHOR_VIEW
|
||||
from util.sandboxing import can_execute_unsafe_code, get_python_lib_zip
|
||||
from xblock.django.request import django_to_webob_request, webob_to_django_response
|
||||
from xblock.exceptions import NoSuchHandlerError
|
||||
from xblock.fragment import Fragment
|
||||
from xblock.runtime import KvsFieldData
|
||||
from xblock_config.models import StudioConfig
|
||||
from xblock_django.user_service import DjangoXBlockUserService
|
||||
from xmodule.contentstore.django import contentstore
|
||||
from xmodule.error_module import ErrorDescriptor
|
||||
from xmodule.exceptions import NotFoundError, ProcessingError
|
||||
from xmodule.partitions.partitions_service import PartitionService
|
||||
from xmodule.studio_editable import has_author_view
|
||||
from xmodule.services import SettingsService
|
||||
from xmodule.modulestore.django import modulestore, ModuleI18nService
|
||||
from xmodule.mixin import wrap_with_license
|
||||
from opaque_keys.edx.keys import UsageKey
|
||||
from xmodule.x_module import ModuleSystem
|
||||
from xblock.runtime import KvsFieldData
|
||||
from xblock.django.request import webob_to_django_response, django_to_webob_request
|
||||
from xblock.exceptions import NoSuchHandlerError
|
||||
from xblock.fragment import Fragment
|
||||
from xblock_django.user_service import DjangoXBlockUserService
|
||||
from xmodule.modulestore.django import ModuleI18nService, modulestore
|
||||
from xmodule.services import SettingsService
|
||||
from xmodule.studio_editable import has_author_view
|
||||
from xmodule.x_module import AUTHOR_VIEW, PREVIEW_VIEWS, STUDENT_VIEW, ModuleSystem
|
||||
|
||||
from lms.djangoapps.lms_xblock.field_data import LmsFieldData
|
||||
from cms.lib.xblock.field_data import CmsFieldData
|
||||
|
||||
from util.sandboxing import can_execute_unsafe_code, get_python_lib_zip
|
||||
|
||||
import static_replace
|
||||
from .session_kv_store import SessionKeyValueStore
|
||||
from .helpers import render_from_lms
|
||||
|
||||
from contentstore.utils import get_visibility_partition_info
|
||||
from contentstore.views.access import get_user_role
|
||||
from xblock_config.models import StudioConfig
|
||||
from .session_kv_store import SessionKeyValueStore
|
||||
|
||||
__all__ = ['preview_handler']
|
||||
|
||||
|
||||
@@ -4,17 +4,17 @@
|
||||
Group Configuration Tests.
|
||||
"""
|
||||
import json
|
||||
import ddt
|
||||
from mock import patch
|
||||
|
||||
from contentstore.utils import reverse_course_url, reverse_usage_url
|
||||
from contentstore.course_group_config import GroupConfiguration, CONTENT_GROUP_CONFIGURATION_NAME
|
||||
import ddt
|
||||
from contentstore.course_group_config import CONTENT_GROUP_CONFIGURATION_NAME, GroupConfiguration
|
||||
from contentstore.tests.utils import CourseTestCase
|
||||
from xmodule.partitions.partitions import Group, UserPartition
|
||||
from contentstore.utils import reverse_course_url, reverse_usage_url
|
||||
from mock import patch
|
||||
from openedx.core.lib.partitions.partitions import Group, UserPartition
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
|
||||
from xmodule.validation import StudioValidation, StudioValidationMessage
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
|
||||
GROUP_CONFIGURATION_JSON = {
|
||||
u'name': u'Test name',
|
||||
|
||||
@@ -1,53 +1,56 @@
|
||||
"""Tests for items views."""
|
||||
import json
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
import ddt
|
||||
|
||||
from mock import patch, Mock, PropertyMock
|
||||
from pytz import UTC
|
||||
from pyquery import PyQuery
|
||||
from webob import Response
|
||||
|
||||
from contentstore.tests.utils import CourseTestCase
|
||||
from contentstore.utils import reverse_course_url, reverse_usage_url
|
||||
from contentstore.views.component import component_handler, get_component_templates
|
||||
from contentstore.views.item import (
|
||||
ALWAYS,
|
||||
VisibilityState,
|
||||
_get_module_info,
|
||||
_get_source_index,
|
||||
_xblock_type_and_display_name,
|
||||
add_container_page_publishing_info,
|
||||
create_xblock_info
|
||||
)
|
||||
from django.conf import settings
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.http import Http404
|
||||
from django.test import TestCase
|
||||
from django.test.client import RequestFactory
|
||||
from django.core.urlresolvers import reverse
|
||||
from contentstore.utils import reverse_usage_url, reverse_course_url
|
||||
|
||||
from mock import Mock, PropertyMock, patch
|
||||
from opaque_keys import InvalidKeyError
|
||||
from opaque_keys.edx.keys import CourseKey, UsageKey
|
||||
from opaque_keys.edx.locations import Location
|
||||
from openedx.core.djangoapps.self_paced.models import SelfPacedConfiguration
|
||||
from contentstore.views.component import (
|
||||
component_handler, get_component_templates
|
||||
from openedx.core.lib.partitions.partitions import (
|
||||
ENROLLMENT_TRACK_PARTITION_ID,
|
||||
MINIMUM_STATIC_PARTITION_ID,
|
||||
Group,
|
||||
UserPartition
|
||||
)
|
||||
|
||||
from contentstore.views.item import (
|
||||
create_xblock_info, _get_source_index, _get_module_info, ALWAYS, VisibilityState, _xblock_type_and_display_name,
|
||||
add_container_page_publishing_info
|
||||
)
|
||||
from contentstore.tests.utils import CourseTestCase
|
||||
from openedx.core.lib.xblock_fields.inherited_fields import DEFAULT_START_DATE
|
||||
from pyquery import PyQuery
|
||||
from pytz import UTC
|
||||
from student.tests.factories import UserFactory
|
||||
from webob import Response
|
||||
from xblock.core import XBlockAside
|
||||
from xblock.exceptions import NoSuchHandlerError
|
||||
from xblock.fields import Scope, ScopeIds, String
|
||||
from xblock.fragment import Fragment
|
||||
from xblock.runtime import DictKeyValueStore, KvsFieldData
|
||||
from xblock.test.tools import TestRuntime
|
||||
from xblock_django.models import XBlockConfiguration, XBlockStudioConfiguration, XBlockStudioConfigurationFlag
|
||||
from xblock_django.user_service import DjangoXBlockUserService
|
||||
from xmodule.capa_module import CapaDescriptor
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.modulestore.exceptions import ItemNotFoundError
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase, TEST_DATA_SPLIT_MODULESTORE
|
||||
from xmodule.modulestore.tests.factories import ItemFactory, LibraryFactory, check_mongo_calls, CourseFactory
|
||||
from xmodule.x_module import STUDIO_VIEW, STUDENT_VIEW
|
||||
from xmodule.course_module import DEFAULT_START_DATE
|
||||
from xblock.core import XBlockAside
|
||||
from xblock.fields import Scope, String, ScopeIds
|
||||
from xblock.fragment import Fragment
|
||||
from xblock.runtime import DictKeyValueStore, KvsFieldData
|
||||
from xblock.test.tools import TestRuntime
|
||||
from xblock.exceptions import NoSuchHandlerError
|
||||
from xblock_django.user_service import DjangoXBlockUserService
|
||||
from opaque_keys.edx.keys import UsageKey, CourseKey
|
||||
from opaque_keys.edx.locations import Location
|
||||
from xmodule.partitions.partitions import (
|
||||
Group, UserPartition, ENROLLMENT_TRACK_PARTITION_ID, MINIMUM_STATIC_PARTITION_ID
|
||||
)
|
||||
from xmodule.modulestore.tests.django_utils import TEST_DATA_SPLIT_MODULESTORE, ModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory, LibraryFactory, check_mongo_calls
|
||||
from xmodule.x_module import STUDENT_VIEW, STUDIO_VIEW
|
||||
|
||||
|
||||
class AsideTest(XBlockAside):
|
||||
|
||||
@@ -7,7 +7,7 @@ from json.encoder import JSONEncoder
|
||||
|
||||
from opaque_keys.edx.locations import Location
|
||||
from openedx.core.djangoapps.models.course_details import CourseDetails
|
||||
from xmodule.fields import Date
|
||||
from openedx.core.lib.xblock_fields.fields import Date
|
||||
|
||||
from .course_grading import CourseGradingModel
|
||||
|
||||
|
||||
Reference in New Issue
Block a user