Commit 3b57542a by John Eskew

Revert "Merge pull request #15170 from edx/jeskew/PLAT_1316_partitions_inheritance"

This reverts commit f97f0525, reversing
changes made to 800bcd8e.
parent d71a1d88
......@@ -4,12 +4,13 @@ Class for manipulating groups configuration on a course object.
import json
import logging
from contentstore.utils import reverse_usage_url
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 openedx.core.djangoapps.course_groups.partition_scheme import get_cohorted_user_partition
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.partitions.partitions import UserPartition, MINIMUM_STATIC_PARTITION_ID
from xmodule.partitions.partitions_service import get_all_partitions_for_course
from xmodule.split_test_module import get_split_user_partitions
MINIMUM_GROUP_ID = MINIMUM_STATIC_PARTITION_ID
......
"""
Tests for Studio Course Settings.
"""
import copy
import datetime
import ddt
import json
import copy
import mock
from mock import Mock, patch
import unittest
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 django.test.utils import override_settings
from contentstore.utils import reverse_course_url, reverse_usage_url
from models.settings.course_grading import CourseGradingModel
from models.settings.course_metadata import CourseMetadata
from models.settings.encoder import CourseSettingsEncoder
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 openedx.core.djangoapps.models.course_details import CourseDetails
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 AjaxEnabledTestClient, CourseTestCase
from .utils import CourseTestCase, AjaxEnabledTestClient
def get_url(course_id, handler_name='settings_handler'):
......
"""
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 unittest import skip
from dateutil.tz import tzutc
from mock import patch
from pytz import UTC
from uuid import uuid4
from unittest import skip
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 course_modes.models import CourseMode
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_HOST, MONGO_PORT_NUM
from xmodule.modulestore.tests.mongo_connection import MONGO_PORT_NUM, MONGO_HOST
from xmodule.modulestore.tests.utils import (
LocationMixin,
MixedSplitTestCase,
MongoContentstoreBuilder,
create_modulestore_instance
create_modulestore_instance, LocationMixin,
MixedSplitTestCase, MongoContentstoreBuilder
)
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,17 +2,19 @@
import collections
from datetime import datetime, timedelta
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 django.test import TestCase
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
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
class LMSLinksTestCase(TestCase):
......
......@@ -4,23 +4,26 @@ 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 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.partitions.partitions_service import get_all_partitions_for_course
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,7 +70,6 @@ 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
......@@ -95,6 +94,7 @@ 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.license import wrap_with_license
from openedx.core.lib.partitions.partitions_service import PartitionService
from openedx.core.lib.xblock_utils import (
replace_static_urls,
request_token,
wrap_fragment,
wrap_xblock,
wrap_xblock_aside,
xblock_local_resource_url
replace_static_urls, wrap_xblock, wrap_fragment, wrap_xblock_aside, request_token, xblock_local_resource_url,
)
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.x_module import PREVIEW_VIEWS, STUDENT_VIEW, AUTHOR_VIEW
from xmodule.contentstore.django import contentstore
from xmodule.error_module import ErrorDescriptor
from xmodule.exceptions import NotFoundError, ProcessingError
from xmodule.modulestore.django import ModuleI18nService, modulestore
from xmodule.services import SettingsService
from xmodule.partitions.partitions_service import PartitionService
from xmodule.studio_editable import has_author_view
from xmodule.x_module import AUTHOR_VIEW, PREVIEW_VIEWS, STUDENT_VIEW, ModuleSystem
from xmodule.services import SettingsService
from xmodule.modulestore.django import modulestore, ModuleI18nService
from openedx.core.lib.license 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 .helpers import render_from_lms
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
__all__ = ['preview_handler']
......
......@@ -4,17 +4,17 @@
Group Configuration Tests.
"""
import json
import ddt
from contentstore.course_group_config import CONTENT_GROUP_CONFIGURATION_NAME, GroupConfiguration
from contentstore.tests.utils import CourseTestCase
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 contentstore.utils import reverse_course_url, reverse_usage_url
from contentstore.course_group_config import GroupConfiguration, CONTENT_GROUP_CONFIGURATION_NAME
from contentstore.tests.utils import CourseTestCase
from xmodule.partitions.partitions import Group, UserPartition
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',
......
"""Tests for items views."""
import json
from datetime import datetime, timedelta
import ddt
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 mock import patch, Mock, PropertyMock
from pytz import UTC
from pyquery import PyQuery
from webob import Response
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 mock import Mock, PropertyMock, patch
from django.core.urlresolvers import reverse
from contentstore.utils import reverse_usage_url, reverse_course_url
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 openedx.core.lib.partitions.partitions import (
ENROLLMENT_TRACK_PARTITION_ID,
MINIMUM_STATIC_PARTITION_ID,
Group,
UserPartition
from contentstore.views.component import (
component_handler, get_component_templates
)
from openedx.core.lib.xblock_fields.inherited_fields import DEFAULT_START_DATE
from pyquery import PyQuery
from pytz import UTC
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 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 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
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
)
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 openedx.core.lib.xblock_fields.fields import Date
from xmodule.fields import Date
from .course_grading import CourseGradingModel
......
......@@ -434,7 +434,7 @@ P3P_HEADER = 'CP="Open EdX does not have a P3P policy."'
############# XBlock Configuration ##########
# Import after sys.path fixup
from openedx.core.lib.xblock_fields.inherited_fields import InheritanceMixin
from xmodule.modulestore.inheritance import InheritanceMixin
from xmodule.modulestore import prefer_xmodules
from xmodule.x_module import XModuleMixin
......
"""
Tests for the Studio authoring XBlock mixin.
"""
from course_modes.tests.factories import CourseModeFactory
from django.conf import settings
from django.test.utils import override_settings
from openedx.core.lib.partitions.partitions import (
ENROLLMENT_TRACK_PARTITION_ID,
MINIMUM_STATIC_PARTITION_ID,
Group,
UserPartition
)
from course_modes.tests.factories import CourseModeFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from xmodule.partitions.partitions import (
Group, UserPartition, ENROLLMENT_TRACK_PARTITION_ID, MINIMUM_STATIC_PARTITION_ID
)
class AuthoringMixinTestCase(ModuleStoreTestCase):
......
......@@ -11,27 +11,26 @@ import struct
import sys
import traceback
from django.conf import settings
# We don't want to force a dependency on datadog, so make the import conditional
try:
import dogstats_wrapper as dog_stats_api
except ImportError:
dog_stats_api = None
from pytz import utc
from capa.capa_problem import LoncapaProblem, LoncapaSystem
from capa.inputtypes import Status
from capa.responsetypes import LoncapaProblemError, ResponseError, StudentInputError
from capa.responsetypes import StudentInputError, ResponseError, LoncapaProblemError
from capa.util import convert_files_to_filenames, get_inner_html_from_xpath
from django.conf import settings
from openedx.core.djangolib.markup import HTML, Text
from openedx.core.lib.xblock_fields.fields import Date, Timedelta
from pytz import utc
from xblock.fields import Boolean, Dict, Float, Integer, Scope, String, XMLString
from xblock.scorable import ScorableXBlockMixin, Score
from xmodule.capa_base_constants import RANDOMIZATION, SHOW_CORRECTNESS, SHOWANSWER
from xmodule.capa_base_constants import RANDOMIZATION, SHOWANSWER, SHOW_CORRECTNESS
from xmodule.exceptions import NotFoundError
from .fields import Date, Timedelta
from .progress import Progress
# We don't want to force a dependency on datadog, so make the import conditional
try:
import dogstats_wrapper as dog_stats_api
except ImportError:
dog_stats_api = None
from openedx.core.djangolib.markup import HTML, Text
log = logging.getLogger("edx.courseware")
......
......@@ -12,7 +12,7 @@ from math import exp
from pytz import utc
from openedx.core.lib.xblock_fields.inherited_fields import DEFAULT_START_DATE
DEFAULT_START_DATE = datetime(2030, 1, 1, tzinfo=utc)
def clean_course_key(course_key, padding_char):
......
......@@ -10,15 +10,16 @@ import requests
from lazy import lazy
from lxml import etree
from openedx.core.lib.license import LicenseMixin
from openedx.core.lib.xblock_fields.fields import Date
from openedx.core.lib.xblock_fields.inherited_fields import DEFAULT_START_DATE
from path import Path as path
from pytz import utc
from xblock.fields import Boolean, Dict, Float, Integer, List, Scope, String
from xblock.fields import Scope, List, String, Dict, Boolean, Integer, Float
from xmodule import course_metadata_utils
from xmodule.course_metadata_utils import DEFAULT_START_DATE
from xmodule.graders import grader_from_conf
from xmodule.seq_module import SequenceDescriptor, SequenceModule
from xmodule.tabs import CourseTabList, InvalidTabsException
from .fields import Date
log = logging.getLogger(__name__)
......
......@@ -253,38 +253,3 @@ class RelativeTime(JSONField):
return value
return self.from_json(value)
class TimeInfo(object):
"""
This is a simple object that calculates and stores datetime information for an XModule
based on the due date and the grace period string
So far it parses out three different pieces of time information:
self.display_due_date - the 'official' due date that gets displayed to students
self.grace_period - the length of the grace period
self.close_date - the real due date
"""
_delta_standin = Timedelta()
def __init__(self, due_date, grace_period_string_or_timedelta):
if due_date is not None:
self.display_due_date = due_date
else:
self.display_due_date = None
if grace_period_string_or_timedelta is not None and self.display_due_date:
if isinstance(grace_period_string_or_timedelta, basestring):
try:
self.grace_period = TimeInfo._delta_standin.from_json(grace_period_string_or_timedelta)
except:
log.error("Error parsing the grace period {0}".format(grace_period_string_or_timedelta))
raise
else:
self.grace_period = grace_period_string_or_timedelta
self.close_date = self.display_due_date + self.grace_period
else:
self.grace_period = None
self.close_date = self.display_due_date
......@@ -13,45 +13,46 @@ structure:
"""
import copy
from datetime import datetime
from importlib import import_module
import logging
import pymongo
import re
import sys
from datetime import datetime
from importlib import import_module
from uuid import uuid4
import pymongo
from bson.son import SON
from contracts import contract, new_contract
from fs.osfs import OSFS
from mongodb_proxy import autoretry_read
from opaque_keys.edx.keys import AssetKey, CourseKey, UsageKey
from opaque_keys.edx.locations import BlockUsageLocator, Location, SlashSeparatedCourseKey
from opaque_keys.edx.keys import UsageKey, CourseKey, AssetKey
from opaque_keys.edx.locations import Location, BlockUsageLocator, SlashSeparatedCourseKey
from opaque_keys.edx.locator import CourseLocator, LibraryLocator
from openedx.core.lib.partitions.partitions_service import PartitionService
from openedx.core.lib.xblock_fields.inherited_fields import InheritanceMixin
from path import Path as path
from pytz import UTC
from xblock.core import XBlock
from xblock.exceptions import InvalidScopeError
from xblock.fields import Reference, ReferenceList, ReferenceValueDict, Scope, ScopeIds
from xblock.fields import Scope, ScopeIds, Reference, ReferenceList, ReferenceValueDict
from xblock.runtime import KvsFieldData
from xmodule.assetstore import AssetMetadata, CourseAssetsFromStorage
from xmodule.course_module import CourseSummary
from xmodule.error_module import ErrorDescriptor
from xmodule.errortracker import exc_info_to_str, null_error_tracker
from xmodule.errortracker import null_error_tracker, exc_info_to_str
from xmodule.exceptions import HeartbeatFailure
from xmodule.mako_module import MakoDescriptorSystem
from xmodule.modulestore import BulkOperationsMixin, BulkOpsRecord, ModuleStoreEnum, ModuleStoreWriteBase
from xmodule.modulestore.draft_and_published import DIRECT_ONLY_CATEGORIES, ModuleStoreDraftAndPublished
from xmodule.mongo_utils import connect_to_mongodb, create_collection_index
from xmodule.modulestore import ModuleStoreWriteBase, ModuleStoreEnum, BulkOperationsMixin, BulkOpsRecord
from xmodule.modulestore.draft_and_published import ModuleStoreDraftAndPublished, DIRECT_ONLY_CATEGORIES
from xmodule.modulestore.edit_info import EditInfoRuntimeMixin
from xmodule.modulestore.exceptions import DuplicateCourseError, ItemNotFoundError, ReferentialIntegrityError
from xmodule.modulestore.inheritance import InheritanceKeyValueStore, inherit_metadata
from xmodule.modulestore.store_utilities import DETACHED_XBLOCK_TYPES
from xmodule.modulestore.exceptions import ItemNotFoundError, DuplicateCourseError, ReferentialIntegrityError
from xmodule.modulestore.inheritance import InheritanceMixin, inherit_metadata, InheritanceKeyValueStore
from xmodule.partitions.partitions_service import PartitionService
from xmodule.modulestore.xml import CourseLocationManager
from xmodule.mongo_utils import connect_to_mongodb, create_collection_index
from xmodule.modulestore.store_utilities import DETACHED_XBLOCK_TYPES
from xmodule.services import SettingsService
log = logging.getLogger(__name__)
new_contract('CourseKey', CourseKey)
......
import logging
import sys
import logging
from contracts import contract, new_contract
from fs.osfs import OSFS
from lazy import lazy
from opaque_keys.edx.locator import BlockUsageLocator, CourseLocator, DefinitionLocator, LibraryLocator, LocalId
from openedx.core.lib.xblock_fields.inherited_fields import InheritanceMixin
from xblock.core import XBlock
from xblock.runtime import KvsFieldData, KeyValueStore
from xblock.fields import ScopeIds
from xblock.runtime import KeyValueStore, KvsFieldData
from xmodule.error_module import ErrorDescriptor
from xmodule.errortracker import exc_info_to_str
from xblock.core import XBlock
from opaque_keys.edx.locator import BlockUsageLocator, LocalId, CourseLocator, LibraryLocator, DefinitionLocator
from xmodule.library_tools import LibraryToolsService
from xmodule.mako_module import MakoDescriptorSystem
from xmodule.error_module import ErrorDescriptor
from xmodule.errortracker import exc_info_to_str
from xmodule.modulestore import BlockData
from xmodule.modulestore.edit_info import EditInfoRuntimeMixin
from xmodule.modulestore.exceptions import ItemNotFoundError
from xmodule.modulestore.inheritance import inheriting_field_data
from xmodule.modulestore.inheritance import inheriting_field_data, InheritanceMixin
from xmodule.modulestore.split_mongo import BlockKey, CourseEnvelope
from xmodule.modulestore.split_mongo.definition_lazy_loader import DefinitionLazyLoader
from xmodule.modulestore.split_mongo.id_manager import SplitMongoIdManager
from xmodule.modulestore.split_mongo.definition_lazy_loader import DefinitionLazyLoader
from xmodule.modulestore.split_mongo.split_mongo_kvs import SplitMongoKVS
from xmodule.x_module import XModuleMixin
......
......@@ -57,56 +57,41 @@ import copy
import datetime
import hashlib
import logging
from collections import defaultdict
from importlib import import_module
from types import NoneType
import six
from bson.objectid import ObjectId
from ccx_keys.locator import CCXBlockUsageLocator, CCXLocator
from contracts import contract, new_contract
from importlib import import_module
from mongodb_proxy import autoretry_read
from opaque_keys.edx.keys import CourseKey
from opaque_keys.edx.locator import (
BlockUsageLocator,
CourseLocator,
DefinitionLocator,
LibraryLocator,
LocalId,
VersionTree
)
from openedx.core.lib.partitions.partitions_service import PartitionService
from openedx.core.lib.xblock_fields.inherited_fields import InheritanceMixin
from path import Path as path
from pytz import UTC
from bson.objectid import ObjectId
from xblock.core import XBlock
from xblock.fields import Reference, ReferenceList, ReferenceValueDict, Scope
from xmodule.assetstore import AssetMetadata
from xblock.fields import Scope, Reference, ReferenceList, ReferenceValueDict
from xmodule.course_module import CourseSummary
from xmodule.error_module import ErrorDescriptor
from xmodule.errortracker import null_error_tracker
from xmodule.modulestore import (
BlockData,
BulkOperationsMixin,
BulkOpsRecord,
ModuleStoreEnum,
ModuleStoreWriteBase,
SortedAssetList
from opaque_keys.edx.keys import CourseKey
from opaque_keys.edx.locator import (
BlockUsageLocator, DefinitionLocator, CourseLocator, LibraryLocator, VersionTree, LocalId,
)
from xmodule.modulestore.exceptions import (
DuplicateCourseError,
DuplicateItemError,
InsufficientSpecificationError,
MultipleCourseBlocksFound,
VersionConflictError
from ccx_keys.locator import CCXLocator, CCXBlockUsageLocator
from xmodule.modulestore.exceptions import InsufficientSpecificationError, VersionConflictError, DuplicateItemError, \
DuplicateCourseError, MultipleCourseBlocksFound
from xmodule.modulestore import (
inheritance, ModuleStoreWriteBase, ModuleStoreEnum,
BulkOpsRecord, BulkOperationsMixin, SortedAssetList, BlockData
)
from xmodule.modulestore.split_mongo import BlockKey, CourseEnvelope
from xmodule.modulestore.split_mongo.mongo_connection import DuplicateKeyError, MongoConnection
from xmodule.modulestore.store_utilities import DETACHED_XBLOCK_TYPES
from ..exceptions import ItemNotFoundError
from .caching_descriptor_system import CachingDescriptorSystem
from xmodule.partitions.partitions_service import PartitionService
from xmodule.modulestore.split_mongo.mongo_connection import MongoConnection, DuplicateKeyError
from xmodule.modulestore.split_mongo import BlockKey, CourseEnvelope
from xmodule.modulestore.store_utilities import DETACHED_XBLOCK_TYPES
from xmodule.error_module import ErrorDescriptor
from collections import defaultdict
from types import NoneType
from xmodule.assetstore import AssetMetadata
log = logging.getLogger(__name__)
......@@ -2164,7 +2149,7 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
else:
inherited_settings = parent_xblock.xblock_kvs.inherited_settings.copy()
if fields is not None:
for field_name in InheritanceMixin.fields:
for field_name in inheritance.InheritanceMixin.fields:
if field_name in fields:
inherited_settings[field_name] = fields[field_name]
......@@ -2713,7 +2698,7 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
# update the inheriting w/ what should pass to children
inheriting_settings = inherited_settings_map[block_key].copy()
block_fields = block_data.fields
for field_name in InheritanceMixin.fields:
for field_name in inheritance.InheritanceMixin.fields:
if field_name in block_fields:
inheriting_settings[field_name] = block_fields[field_name]
......
......@@ -14,25 +14,23 @@ and then for each combination of modulestores, performing the sequence:
import itertools
import os
from path import Path as path
from shutil import rmtree
from tempfile import mkdtemp
import ddt
from mock import patch
from nose.plugins.attrib import attr
from openedx.core.lib.partitions.tests.test_partitions import PartitionTestCase
from path import Path as path
from mock import patch
from xmodule.tests import CourseComparisonTest
from xmodule.modulestore.xml_importer import import_course_from_xml
from xmodule.modulestore.xml_exporter import export_course_to_xml
from xmodule.modulestore.tests.utils import mock_tab_from_json
from xmodule.partitions.tests.test_partitions import PartitionTestCase
from xmodule.modulestore.tests.utils import (
CONTENTSTORE_SETUPS,
MODULESTORE_SETUPS,
SPLIT_MODULESTORE_SETUP,
TEST_DATA_DIR,
MongoContentstoreBuilder,
mock_tab_from_json
MongoContentstoreBuilder, MODULESTORE_SETUPS, SPLIT_MODULESTORE_SETUP,
CONTENTSTORE_SETUPS, TEST_DATA_DIR
)
from xmodule.modulestore.xml_exporter import export_course_to_xml
from xmodule.modulestore.xml_importer import import_course_from_xml
from xmodule.tests import CourseComparisonTest
COURSE_DATA_NAMES = (
'toy',
......
"""
Unit tests for the Mixed Modulestore, with DDT for the various stores (Split, Draft, XML)
"""
from collections import namedtuple
import datetime
import itertools
import logging
import ddt
import itertools
import mimetypes
from collections import namedtuple
from contextlib import contextmanager
from shutil import rmtree
from tempfile import mkdtemp
from uuid import uuid4
from contextlib import contextmanager
from mock import patch, Mock, call
import ddt
import pymongo
# Mixed modulestore depends on django, so we'll manually configure some django settings
# before importing the module
# TODO remove this import and the configuration -- xmodule should not depend on django!
from django.conf import settings
from mock import Mock, call, patch
from nose import SkipTest
# This import breaks this test file when run separately. Needs to be fixed! (PLAT-449)
from nose.plugins.attrib import attr
from opaque_keys.edx.locations import SlashSeparatedCourseKey
from opaque_keys.edx.locator import BlockUsageLocator, CourseLocator, LibraryLocator
from openedx.core.lib.xblock_fields.inherited_fields import InheritanceMixin
from nose import SkipTest
import pymongo
from pytz import UTC
from shutil import rmtree
from tempfile import mkdtemp
from xmodule.x_module import XModuleMixin
from xmodule.modulestore.edit_info import EditInfoMixin
from xmodule.modulestore.inheritance import InheritanceMixin
from xmodule.modulestore.tests.utils import MongoContentstoreBuilder
from xmodule.contentstore.content import StaticContent
from xmodule.modulestore.xml_importer import import_course_from_xml
from xmodule.modulestore.xml_exporter import export_course_to_xml
from xmodule.modulestore.tests.test_asides import AsideTestType
from xblock.core import XBlockAside
from xblock.fields import Scope, ScopeIds, String
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 xmodule.contentstore.content import StaticContent
if not settings.configured:
settings.configure()
from opaque_keys.edx.locations import SlashSeparatedCourseKey
from opaque_keys.edx.locator import BlockUsageLocator, CourseLocator, LibraryLocator
from xmodule.exceptions import InvalidVersionError
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.draft_and_published import DIRECT_ONLY_CATEGORIES, UnsupportedRevisionError
from xmodule.modulestore.edit_info import EditInfoMixin
from xmodule.modulestore.exceptions import (
DuplicateCourseError,
ItemNotFoundError,
NoPathToItem,
ReferentialIntegrityError
)
from xmodule.modulestore.draft_and_published import UnsupportedRevisionError, DIRECT_ONLY_CATEGORIES
from xmodule.modulestore.exceptions import ItemNotFoundError, DuplicateCourseError, ReferentialIntegrityError, NoPathToItem
from xmodule.modulestore.mixed import MixedModuleStore
from xmodule.modulestore.search import navigation_index, path_to_location
from xmodule.modulestore.search import path_to_location, navigation_index
from xmodule.modulestore.store_utilities import DETACHED_XBLOCK_TYPES
from xmodule.modulestore.tests.factories import check_exact_number_of_calls, check_mongo_calls, mongo_uses_error_check
from xmodule.modulestore.tests.mongo_connection import MONGO_HOST, MONGO_PORT_NUM
from xmodule.modulestore.tests.test_asides import AsideTestType
from xmodule.modulestore.tests.utils import (
LocationMixin,
MongoContentstoreBuilder,
create_modulestore_instance,
mock_tab_from_json
)
from xmodule.modulestore.xml_exporter import export_course_to_xml
from xmodule.modulestore.xml_importer import import_course_from_xml
from xmodule.modulestore.tests.factories import check_mongo_calls, check_exact_number_of_calls, \
mongo_uses_error_check
from xmodule.modulestore.tests.utils import create_modulestore_instance, LocationMixin, mock_tab_from_json
from xmodule.modulestore.tests.mongo_connection import MONGO_PORT_NUM, MONGO_HOST
from xmodule.tests import DATA_DIR, CourseComparisonTest
from xmodule.x_module import XModuleMixin
if not settings.configured:
settings.configure()
log = logging.getLogger(__name__)
......
"""
Unit tests for the Mongo modulestore
"""
# pylint: disable=protected-access
# pylint: disable=no-name-in-module
# pylint: disable=bad-continuation
from nose.tools import assert_equals, assert_raises, \
assert_not_equals, assert_false, assert_true, assert_greater, assert_is_instance, assert_is_none
# pylint: enable=E0611
from path import Path as path
import pymongo
import logging
import shutil
import unittest
from datetime import datetime
from tempfile import mkdtemp
from uuid import uuid4
import pymongo
from git.test.lib.asserts import assert_not_none
from mock import patch
# pylint: disable=no-name-in-module
# pylint: disable=bad-continuation
from nose.tools import (
assert_equals,
assert_false,
assert_greater,
assert_in,
assert_is_instance,
assert_is_none,
assert_not_equals,
assert_raises,
assert_true
)
from opaque_keys.edx.keys import CourseKey, UsageKey
from opaque_keys.edx.locations import AssetLocation, Location, SlashSeparatedCourseKey
from opaque_keys.edx.locator import CourseLocator, LibraryLocator
from openedx.core.lib.xblock_fields.inherited_fields import InheritanceMixin
from path import Path as path
from datetime import datetime
from pytz import UTC
import unittest
from mock import patch
from xblock.core import XBlock
from xblock.exceptions import InvalidScopeError
from xblock.fields import Reference, ReferenceList, ReferenceValueDict, Scope
from xblock.fields import Scope, Reference, ReferenceList, ReferenceValueDict
from xblock.runtime import KeyValueStore
from xmodule.contentstore.mongo import MongoContentStore
from xmodule.exceptions import NotFoundError
from xblock.exceptions import InvalidScopeError
from xmodule.tests import DATA_DIR
from opaque_keys.edx.keys import CourseKey
from opaque_keys.edx.locations import Location
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.draft import DraftModuleStore
from xmodule.modulestore.edit_info import EditInfoMixin
from xmodule.modulestore.exceptions import ItemNotFoundError
from xmodule.modulestore.mongo import MongoKeyValueStore
from xmodule.modulestore.mongo.base import as_draft
from xmodule.modulestore.tests.mongo_connection import MONGO_HOST, MONGO_PORT_NUM
from xmodule.modulestore.tests.utils import LocationMixin, mock_tab_from_json
from xmodule.modulestore.draft import DraftModuleStore
from opaque_keys.edx.locations import SlashSeparatedCourseKey, AssetLocation
from opaque_keys.edx.locator import LibraryLocator, CourseLocator
from opaque_keys.edx.keys import UsageKey
from xmodule.modulestore.xml_exporter import export_course_to_xml
from xmodule.modulestore.xml_importer import import_course_from_xml, perform_xlint
from xmodule.tests import DATA_DIR
from xmodule.contentstore.mongo import MongoContentStore
from nose.tools import assert_in
from xmodule.exceptions import NotFoundError
from git.test.lib.asserts import assert_not_none
from xmodule.x_module import XModuleMixin
from xmodule.modulestore.mongo.base import as_draft
from xmodule.modulestore.tests.mongo_connection import MONGO_PORT_NUM, MONGO_HOST
from xmodule.modulestore.tests.utils import LocationMixin, mock_tab_from_json
from xmodule.modulestore.edit_info import EditInfoMixin
from xmodule.modulestore.exceptions import ItemNotFoundError
from xmodule.modulestore.inheritance import InheritanceMixin
log = logging.getLogger(__name__)
......
"""
Test split modulestore w/o using any django stuff.
"""
from mock import patch
import datetime
from importlib import import_module
from path import Path as path
import random
import re
import unittest
import uuid
from importlib import import_module
import ddt
from ccx_keys.locator import CCXBlockUsageLocator
from contracts import contract
from django.core.cache import InvalidCacheBackendError, caches
from mock import patch
from nose.plugins.attrib import attr
from opaque_keys.edx.locator import BlockUsageLocator, CourseKey, CourseLocator, LocalId, VersionTree
from django.core.cache import caches, InvalidCacheBackendError
from openedx.core.lib import tempdir
from openedx.core.lib.xblock_fields.fields import Date, Timedelta
from openedx.core.lib.xblock_fields.inherited_fields import InheritanceMixin
from path import Path as path
from xblock.fields import Reference, ReferenceList, ReferenceValueDict
from xmodule.course_module import CourseDescriptor
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.edit_info import EditInfoMixin
from xmodule.modulestore.exceptions import (
DuplicateCourseError,
DuplicateItemError,
InsufficientSpecificationError,
ItemNotFoundError,
VersionConflictError
ItemNotFoundError, VersionConflictError,
DuplicateItemError, DuplicateCourseError,
InsufficientSpecificationError
)
from xmodule.modulestore.split_mongo import BlockKey
from opaque_keys.edx.locator import CourseKey, CourseLocator, BlockUsageLocator, VersionTree, LocalId
from ccx_keys.locator import CCXBlockUsageLocator
from xmodule.modulestore.inheritance import InheritanceMixin
from xmodule.x_module import XModuleMixin
from xmodule.fields import Date, Timedelta
from xmodule.modulestore.split_mongo.split import SplitMongoModuleStore
from xmodule.modulestore.tests.factories import check_mongo_calls
from xmodule.modulestore.tests.mongo_connection import MONGO_HOST, MONGO_PORT_NUM
from xmodule.modulestore.tests.test_modulestore import check_has_course_method
from xmodule.modulestore.split_mongo import BlockKey
from xmodule.modulestore.tests.factories import check_mongo_calls
from xmodule.modulestore.tests.mongo_connection import MONGO_PORT_NUM, MONGO_HOST
from xmodule.modulestore.tests.utils import mock_tab_from_json
from xmodule.x_module import XModuleMixin
from xmodule.modulestore.edit_info import EditInfoMixin
BRANCH_NAME_DRAFT = ModuleStoreEnum.BranchName.draft
BRANCH_NAME_PUBLISHED = ModuleStoreEnum.BranchName.published
......
......@@ -3,16 +3,17 @@ import random
import unittest
import uuid
import mock
from nose.plugins.attrib import attr
from opaque_keys.edx.locator import BlockUsageLocator, CourseLocator
from openedx.core.lib.xblock_fields.inherited_fields import InheritanceMixin
import mock
from opaque_keys.edx.locator import CourseLocator, BlockUsageLocator
from xmodule.modulestore import ModuleStoreEnum
from xmodule.x_module import XModuleMixin
from xmodule.modulestore.inheritance import InheritanceMixin
from xmodule.modulestore.mongo import DraftMongoModuleStore
from xmodule.modulestore.split_mongo.split import SplitMongoModuleStore
from xmodule.modulestore.tests.mongo_connection import MONGO_HOST, MONGO_PORT_NUM
from xmodule.modulestore.tests.mongo_connection import MONGO_PORT_NUM, MONGO_HOST
from xmodule.modulestore.tests.utils import MemoryCache
from xmodule.x_module import XModuleMixin
@attr('mongo')
......
"""
Tests for XML importer.
"""
import importlib
import unittest
from uuid import uuid4
import mock
from opaque_keys.edx.locations import Location, SlashSeparatedCourseKey
from opaque_keys.edx.locator import BlockUsageLocator, CourseLocator
from openedx.core.lib.xblock_fields.inherited_fields import InheritanceMixin
from xblock.fields import List, Scope, ScopeIds, String
from xblock.runtime import DictKeyValueStore, KvsFieldData, Runtime
from xblock.fields import String, Scope, ScopeIds, List
from xblock.runtime import Runtime, KvsFieldData, DictKeyValueStore
from xmodule.x_module import XModuleMixin
from opaque_keys.edx.locations import Location
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.tests.mongo_connection import MONGO_HOST, MONGO_PORT_NUM
from xmodule.modulestore.inheritance import InheritanceMixin
from xmodule.modulestore.xml_importer import _update_and_import_module, _update_module_location
from xmodule.modulestore.tests.mongo_connection import MONGO_PORT_NUM, MONGO_HOST
from opaque_keys.edx.locations import SlashSeparatedCourseKey
from xmodule.tests import DATA_DIR
from xmodule.x_module import XModuleMixin
from uuid import uuid4
import unittest
import importlib
class ModuleStoreNoSettings(unittest.TestCase):
......
......@@ -2,29 +2,30 @@
Helper classes and methods for running modulestore tests without Django.
"""
import random
from contextlib import contextmanager, nested
from importlib import import_module
from opaque_keys.edx.keys import UsageKey
from path import Path as path
from shutil import rmtree
from tempfile import mkdtemp
from unittest import TestCase
from opaque_keys.edx.keys import UsageKey
from openedx.core.lib.xblock_fields.inherited_fields import InheritanceMixin
from path import Path as path
from xblock.fields import XBlockMixin
from xmodule.x_module import XModuleMixin
from xmodule.contentstore.mongo import MongoContentStore
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.draft_and_published import ModuleStoreDraftAndPublished
from xmodule.modulestore.edit_info import EditInfoMixin
from xmodule.modulestore.inheritance import InheritanceMixin
from xmodule.modulestore.mixed import MixedModuleStore
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.factories import ItemFactory
from xmodule.modulestore.tests.mongo_connection import MONGO_HOST, MONGO_PORT_NUM
from xmodule.modulestore.tests.mongo_connection import MONGO_PORT_NUM, MONGO_HOST
from xmodule.modulestore.xml import XMLModuleStore
from xmodule.tests import DATA_DIR
from xmodule.x_module import XModuleMixin
def load_function(path):
......
......@@ -7,7 +7,7 @@ from django.conf import settings
from django.utils.translation import ugettext_lazy as _
import logging
from .partitions import UserPartition, UserPartitionError, ENROLLMENT_TRACK_PARTITION_ID
from xmodule.partitions.partitions import UserPartition, UserPartitionError, ENROLLMENT_TRACK_PARTITION_ID
from xmodule.modulestore.django import modulestore
......
......@@ -8,11 +8,11 @@ from mock import Mock
from opaque_keys.edx.locator import CourseLocator
from stevedore.extension import Extension, ExtensionManager
from openedx.core.lib.partitions.partitions import (
from xmodule.partitions.partitions import (
Group, UserPartition, UserPartitionError, NoSuchUserPartitionGroupError,
USER_PARTITION_SCHEME_NAMESPACE, ENROLLMENT_TRACK_PARTITION_ID
)
from openedx.core.lib.partitions.partitions_service import (
from xmodule.partitions.partitions_service import (
PartitionService, get_all_partitions_for_course, FEATURES
)
......
......@@ -4,23 +4,22 @@ xModule implementation of a learning sequence
# pylint: disable=abstract-method
import collections
from datetime import datetime
from django.utils.timezone import UTC
import json
import logging
from datetime import datetime
from pkg_resources import resource_string
from django.utils.timezone import UTC
from lxml import etree
from openedx.core.lib.xblock_fields.fields import Date
from xblock.core import XBlock
from xblock.fields import Boolean, Integer, Scope, String
from xblock.fields import Integer, Scope, Boolean, String
from xblock.fragment import Fragment
from .exceptions import NotFoundError
from .fields import Date
from .mako_module import MakoModuleDescriptor
from .progress import Progress
from .x_module import STUDENT_VIEW, XModule
from .x_module import XModule, STUDENT_VIEW
from .xml_module import XmlDescriptor
log = logging.getLogger(__name__)
......
......@@ -2,22 +2,24 @@
Module for running content split tests
"""
import json
import logging
from operator import itemgetter
import json
from webob import Response
from uuid import uuid4
from operator import itemgetter
from lxml import etree
from openedx.core.lib.xblock_fields.inherited_fields import UserPartitionList
from webob import Response
from xblock.core import XBlock
from xblock.fields import Integer, ReferenceValueDict, Scope, String
from xblock.fragment import Fragment
from xmodule.progress import Progress
from xmodule.seq_module import SequenceDescriptor
from xmodule.studio_editable import StudioEditableDescriptor, StudioEditableModule
from xmodule.studio_editable import StudioEditableModule, StudioEditableDescriptor
from xmodule.x_module import XModule, module_attr, STUDENT_VIEW
from xmodule.validation import StudioValidation, StudioValidationMessage
from xmodule.x_module import STUDENT_VIEW, XModule, module_attr
from xmodule.modulestore.inheritance import UserPartitionList
from lxml import etree
from xblock.core import XBlock
from xblock.fields import Scope, Integer, String, ReferenceValueDict
from xblock.fragment import Fragment
log = logging.getLogger('edx.' + __name__)
......
......@@ -25,13 +25,12 @@ from path import Path as path
from opaque_keys.edx.locations import SlashSeparatedCourseKey
from xblock.field_data import DictFieldData
from xblock.fields import ScopeIds, Scope, Reference, ReferenceList, ReferenceValueDict
from openedx.core.lib.xblock_fields.inherited_fields import InheritanceMixin
from xmodule.assetstore import AssetMetadata
from xmodule.error_module import ErrorDescriptor
from xmodule.mako_module import MakoDescriptorSystem
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.draft_and_published import DIRECT_ONLY_CATEGORIES, ModuleStoreDraftAndPublished
from xmodule.modulestore.inheritance import own_metadata
from xmodule.modulestore.inheritance import InheritanceMixin, own_metadata
from xmodule.modulestore.mongo.draft import DraftModuleStore
from xmodule.modulestore.xml import CourseLocationManager
from xmodule.x_module import ModuleSystem, XModuleDescriptor, XModuleMixin
......
......@@ -6,7 +6,6 @@ from datetime import timedelta, datetime
from unittest import TestCase
from pytz import utc
from openedx.core.lib.xblock_fields.inherited_fields import DEFAULT_START_DATE
from xmodule.block_metadata_utils import (
url_name_for_block,
display_name_with_default,
......@@ -17,6 +16,7 @@ from xmodule.course_metadata_utils import (
number_for_course_location,
has_course_started,
has_course_ended,
DEFAULT_START_DATE,
course_start_date_is_default,
may_certify_for_course,
)
......
......@@ -4,7 +4,9 @@ import datetime
import unittest
from django.utils.timezone import UTC
from openedx.core.lib.xblock_fields.fields import Date, RelativeTime, Timedelta, TimeInfo
from xmodule.fields import Date, Timedelta, RelativeTime
from xmodule.timeinfo import TimeInfo
class DateTest(unittest.TestCase):
......
# -*- coding: utf-8 -*-
import datetime
import ddt
import unittest
import ddt
from django.utils.timezone import UTC
from fs.memoryfs import MemoryFS
from lxml import etree
from mock import Mock, patch
from opaque_keys.edx.locations import Location, SlashSeparatedCourseKey
from openedx.core.lib.xblock_fields.fields import Date
from openedx.core.lib.xblock_fields.inherited_fields import InheritanceMixin
from xblock.core import XBlock
from xblock.fields import Integer, Scope, String
from xblock.runtime import DictKeyValueStore, KvsFieldData
from django.utils.timezone import UTC
from xmodule.xml_module import is_pointer_tag
from opaque_keys.edx.locations import Location
from xmodule.modulestore import only_xmodules
from xmodule.modulestore.xml import ImportSystem, XMLModuleStore, LibraryXMLModuleStore
from xmodule.modulestore.inheritance import compute_inherited_metadata
from xmodule.modulestore.xml import ImportSystem, LibraryXMLModuleStore, XMLModuleStore
from xmodule.tests import DATA_DIR
from xmodule.x_module import XModuleMixin
from xmodule.xml_module import is_pointer_tag
from xmodule.fields import Date
from xmodule.tests import DATA_DIR
from xmodule.modulestore.inheritance import InheritanceMixin
from opaque_keys.edx.locations import SlashSeparatedCourseKey
from xblock.core import XBlock
from xblock.fields import Scope, String, Integer
from xblock.runtime import KvsFieldData, DictKeyValueStore
ORG = 'test_org'
COURSE = 'test_course'
......
......@@ -2,17 +2,17 @@
"""Test for LTI Xmodule functional logic."""
import datetime
import textwrap
import urllib
from copy import copy
from django.utils.timezone import UTC
from mock import Mock, patch, PropertyMock
import textwrap
from lxml import etree
from mock import Mock, PropertyMock, patch
from openedx.core.lib.xblock_fields.fields import Timedelta
from webob.request import Request
from xmodule.lti_2_util import LTIError
from copy import copy
import urllib
from xmodule.fields import Timedelta
from xmodule.lti_module import LTIDescriptor
from xmodule.lti_2_util import LTIError
from . import LogicTest
......
......@@ -3,20 +3,17 @@ Tests for the Split Testing Module
"""
import ddt
import lxml
from fs.memoryfs import MemoryFS
from mock import Mock, patch
from openedx.core.lib.partitions.partitions import MINIMUM_STATIC_PARTITION_ID, Group, UserPartition
from openedx.core.lib.partitions.tests.test_partitions import (
MockPartitionService,
MockUserPartitionScheme,
PartitionTestCase
)
from xmodule.split_test_module import SplitTestDescriptor, SplitTestFields, get_split_user_partitions
from xmodule.tests import get_test_system
from fs.memoryfs import MemoryFS
from xmodule.partitions.tests.test_partitions import MockPartitionService, PartitionTestCase, MockUserPartitionScheme
from xmodule.tests.xml import factories as xml
from xmodule.tests.xml import XModuleXmlImportTest
from xmodule.validation import StudioValidationMessage
from xmodule.tests import get_test_system
from xmodule.x_module import AUTHOR_VIEW, STUDENT_VIEW
from xmodule.validation import StudioValidationMessage
from xmodule.split_test_module import SplitTestDescriptor, SplitTestFields, get_split_user_partitions
from xmodule.partitions.partitions import Group, UserPartition, MINIMUM_STATIC_PARTITION_ID
class SplitTestModuleFactory(xml.XmlImportFactory):
......
......@@ -4,29 +4,24 @@
import unittest
from mock import Mock
from nose.tools import ( # pylint: disable=no-name-in-module
assert_equals,
assert_false,
assert_in,
assert_not_equals,
assert_not_in,
assert_true
)
from nose.tools import assert_equals, assert_not_equals, assert_true, assert_false, assert_in, assert_not_in # pylint: disable=no-name-in-module
from opaque_keys.edx.locator import BlockUsageLocator, CourseLocator
from openedx.core.lib.xblock_fields.fields import Date, RelativeTime, Timedelta
from openedx.core.lib.xblock_fields.inherited_fields import InheritanceMixin
from xblock.field_data import DictFieldData
from xblock.fields import Any, Boolean, Dict, Float, Integer, List, Scope, String
from xblock.runtime import DictKeyValueStore, KvsFieldData
from xmodule.course_module import CourseDescriptor
from xmodule.modulestore.inheritance import InheritanceKeyValueStore, InheritingFieldData
from xblock.fields import Scope, String, Dict, Boolean, Integer, Float, Any, List
from xblock.runtime import KvsFieldData, DictKeyValueStore
from xmodule.fields import Date, Timedelta, RelativeTime
from xmodule.modulestore.inheritance import InheritanceKeyValueStore, InheritanceMixin, InheritingFieldData
from xmodule.modulestore.split_mongo.split_mongo_kvs import SplitMongoKVS
from xmodule.xml_module import XmlDescriptor, serialize_field, deserialize_field
from xmodule.course_module import CourseDescriptor
from xmodule.seq_module import SequenceDescriptor
from xmodule.x_module import XModuleMixin
from xmodule.tests import get_test_descriptor_system
from xmodule.tests.xml import XModuleXmlImportTest
from xmodule.tests.xml.factories import CourseFactory, ProblemFactory, SequenceFactory
from xmodule.x_module import XModuleMixin
from xmodule.xml_module import XmlDescriptor, deserialize_field, serialize_field
from xmodule.tests.xml.factories import CourseFactory, SequenceFactory, ProblemFactory
class CrazyJsonString(String):
......
......@@ -4,13 +4,14 @@ Factories for generating edXML for testing XModule import
import inspect
from factory import Factory, Sequence, lazy_attribute, post_generation
from fs.memoryfs import MemoryFS
from factory import Factory, lazy_attribute, post_generation, Sequence
from lxml import etree
from openedx.core.lib.xblock_fields.inherited_fields import InheritanceMixin
from xblock.mixins import HierarchyMixin
from xmodule.modulestore import only_xmodules
from xmodule.modulestore.inheritance import InheritanceMixin
from xmodule.x_module import XModuleMixin
from xmodule.modulestore import only_xmodules
class XmlImportData(object):
......
import logging
from xmodule.fields import Timedelta
log = logging.getLogger(__name__)
class TimeInfo(object):
"""
This is a simple object that calculates and stores datetime information for an XModule
based on the due date and the grace period string
So far it parses out three different pieces of time information:
self.display_due_date - the 'official' due date that gets displayed to students
self.grace_period - the length of the grace period
self.close_date - the real due date
"""
_delta_standin = Timedelta()
def __init__(self, due_date, grace_period_string_or_timedelta):
if due_date is not None:
self.display_due_date = due_date
else:
self.display_due_date = None
if grace_period_string_or_timedelta is not None and self.display_due_date:
if isinstance(grace_period_string_or_timedelta, basestring):
try:
self.grace_period = TimeInfo._delta_standin.from_json(grace_period_string_or_timedelta)
except:
log.error("Error parsing the grace period {0}".format(grace_period_string_or_timedelta))
raise
else:
self.grace_period = grace_period_string_or_timedelta
self.close_date = self.display_due_date + self.grace_period
else:
self.grace_period = None
self.close_date = self.display_due_date
......@@ -8,24 +8,26 @@ StudioViewHandlers are handlers for video descriptor instance.
import json
import logging
from datetime import datetime
from opaque_keys.edx.locator import CourseLocator
from openedx.core.lib.xblock_fields.fields import RelativeTime
from webob import Response
from xblock.core import XBlock
from xmodule.exceptions import NotFoundError
from xmodule.fields import RelativeTime
from opaque_keys.edx.locator import CourseLocator
from .transcripts_utils import (
Transcript,
get_or_create_sjson,
TranscriptException,
TranscriptsGenerationException,
generate_sjson_for_all_speeds,
get_or_create_sjson,
youtube_speed_dict,
Transcript,
save_to_store,
subs_filename,
youtube_speed_dict
subs_filename
)
log = logging.getLogger(__name__)
......
......@@ -3,8 +3,8 @@ XFields for video module.
"""
import datetime
from openedx.core.lib.xblock_fields.fields import RelativeTime
from xblock.fields import Boolean, DateTime, Dict, Float, List, Scope, String
from xblock.fields import Scope, String, Float, Boolean, List, Dict, DateTime
from xmodule.fields import RelativeTime
# Make '_' a no-op so we can scrape strings. Using lambda instead of
# `django.utils.translation.ugettext_noop` because Django cannot be imported in this file
......
......@@ -2,42 +2,41 @@ import logging
import os
import sys
import time
from collections import namedtuple
from functools import partial
from pkg_resources import resource_exists, resource_isdir, resource_listdir, resource_string
import dogstats_wrapper as dog_stats_api
import yaml
from contracts import contract, new_contract
from lazy import lazy
from functools import partial
from lxml import etree
from opaque_keys.edx.asides import AsideDefinitionKeyV2, AsideUsageKeyV2
from opaque_keys.edx.keys import UsageKey
from openedx.core.lib.xblock_fields.fields import RelativeTime
from collections import namedtuple
from pkg_resources import (
resource_exists,
resource_listdir,
resource_string,
resource_isdir,
)
from webob import Response
from webob.multidict import MultiDict
from lazy import lazy
from xblock.core import XBlock, XBlockAside
from xblock.fields import (
Dict,
Float,
Integer,
List,
Reference,
ReferenceList,
ReferenceValueDict,
Scope,
ScopeIds,
String,
UserScope
Scope, Integer, Float, List,
String, Dict, ScopeIds, Reference, ReferenceList,
ReferenceValueDict, UserScope
)
from xblock.fragment import Fragment
from xblock.runtime import IdGenerator, IdReader, Runtime
from xblock.runtime import Runtime, IdReader, IdGenerator
from xmodule import block_metadata_utils
from xmodule.fields import RelativeTime
from xmodule.errortracker import exc_info_to_str
from xmodule.exceptions import UndefinedContext
from xmodule.modulestore.exceptions import ItemNotFoundError
from opaque_keys.edx.keys import UsageKey
from opaque_keys.edx.asides import AsideUsageKeyV2, AsideDefinitionKeyV2
from xmodule.exceptions import UndefinedContext
import dogstats_wrapper as dog_stats_api
log = logging.getLogger(__name__)
XMODULE_METRIC_NAME = 'edxapp.xmodule'
......
......@@ -3,22 +3,22 @@
End-to-end tests related to the cohort management on the LMS Instructor Dashboard
"""
import os
import uuid
from datetime import datetime
import unicodecsv
from pytz import UTC, utc
from bok_choy.promise import EmptyPromise
from nose.plugins.attrib import attr
from pytz import UTC, utc
from common.test.acceptance.tests.discussion.helpers import CohortTestMixin
from common.test.acceptance.tests.helpers import UniqueCourseTest, EventsTestMixin, create_user_partition_json
from xmodule.partitions.partitions import Group
from common.test.acceptance.fixtures.course import CourseFixture, XBlockFixtureDesc
from common.test.acceptance.pages.lms.auto_auth import AutoAuthPage
from common.test.acceptance.pages.lms.instructor_dashboard import DataDownloadPage, InstructorDashboardPage
from common.test.acceptance.pages.lms.instructor_dashboard import InstructorDashboardPage, DataDownloadPage
from common.test.acceptance.pages.studio.settings_group_configurations import GroupConfigurationsPage
from common.test.acceptance.tests.discussion.helpers import CohortTestMixin
from common.test.acceptance.tests.helpers import EventsTestMixin, UniqueCourseTest, create_user_partition_json
from openedx.core.lib.partitions.partitions import Group
import os
import unicodecsv
import uuid
@attr(shard=8)
......
......@@ -2,40 +2,42 @@
Test helper functions and base classes.
"""
import functools
import inspect
import json
import unittest
import functools
import operator
import os
import pprint
import unittest
import requests
import os
import urlparse
from contextlib import contextmanager
from datetime import datetime
from unittest import TestCase
from path import Path as path
import requests
from bok_choy.javascript import js_defined
from bok_choy.page_object import XSS_INJECTION
from bok_choy.promise import EmptyPromise, Promise
from bok_choy.web_app_test import WebAppTest
from bok_choy.promise import EmptyPromise, Promise
from bok_choy.page_object import XSS_INJECTION
from capa.tests.response_xml_factory import MultipleChoiceResponseXMLFactory
from common.test.acceptance.pages.studio.auto_auth import AutoAuthPage
from common.test.acceptance.fixtures.course import XBlockFixtureDesc
from opaque_keys.edx.locator import CourseLocator
from path import Path as path
from pymongo import ASCENDING, MongoClient
from pymongo import MongoClient, ASCENDING
from openedx.core.lib.tests.assertions.events import assert_event_matches, is_matching_event, EventMatchTolerates
from xmodule.partitions.partitions import UserPartition
from selenium.common.exceptions import StaleElementReferenceException
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.select import Select
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from unittest import TestCase
from openedx.core.release import doc_version, RELEASE_LINE
from capa.tests.response_xml_factory import MultipleChoiceResponseXMLFactory
from common.test.acceptance.fixtures.course import XBlockFixtureDesc
from common.test.acceptance.pages.common import BASE_URL
from common.test.acceptance.pages.studio.auto_auth import AutoAuthPage
from openedx.core.lib.partitions.partitions import UserPartition
from openedx.core.lib.tests.assertions.events import EventMatchTolerates, assert_event_matches, is_matching_event
from openedx.core.release import RELEASE_LINE, doc_version
MAX_EVENTS_IN_FAILURE_OUTPUT = 20
......
......@@ -4,16 +4,20 @@ Test courseware search
import json
from nose.plugins.attrib import attr
from common.test.acceptance.fixtures.course import XBlockFixtureDesc
from common.test.acceptance.tests.helpers import remove_file
from common.test.acceptance.pages.common.logout import LogoutPage
from common.test.acceptance.pages.lms.courseware_search import CoursewareSearchPage
from common.test.acceptance.pages.studio.auto_auth import AutoAuthPage as StudioAutoAuthPage
from common.test.acceptance.pages.studio.overview import CourseOutlinePage as StudioCourseOutlinePage
from common.test.acceptance.tests.helpers import create_user_partition_json, remove_file
from common.test.acceptance.pages.lms.courseware_search import CoursewareSearchPage
from common.test.acceptance.fixtures.course import XBlockFixtureDesc
from common.test.acceptance.tests.helpers import create_user_partition_json
from xmodule.partitions.partitions import Group
from nose.plugins.attrib import attr
from common.test.acceptance.tests.studio.base_studio_test import ContainerBase
from openedx.core.lib.partitions.partitions import Group
from common.test.acceptance.pages.studio.auto_auth import AutoAuthPage as StudioAutoAuthPage
@attr(shard=1)
......
......@@ -4,17 +4,17 @@ Tests the "preview" selector in the LMS that allows changing between Staff, Lear
"""
from textwrap import dedent
from nose.plugins.attrib import attr
from common.test.acceptance.fixtures.course import CourseFixture, XBlockFixtureDesc
from common.test.acceptance.tests.helpers import UniqueCourseTest, create_user_partition_json
from common.test.acceptance.pages.studio.auto_auth import AutoAuthPage
from common.test.acceptance.pages.lms.courseware import CoursewarePage
from common.test.acceptance.pages.lms.instructor_dashboard import InstructorDashboardPage
from common.test.acceptance.pages.lms.staff_view import StaffCoursewarePage
from common.test.acceptance.pages.studio.auto_auth import AutoAuthPage
from common.test.acceptance.tests.helpers import UniqueCourseTest, create_user_partition_json
from openedx.core.lib.partitions.partitions import ENROLLMENT_TRACK_PARTITION_ID, MINIMUM_STATIC_PARTITION_ID, Group
from common.test.acceptance.fixtures.course import CourseFixture, XBlockFixtureDesc
from bok_choy.promise import EmptyPromise
from xmodule.partitions.partitions import (Group, ENROLLMENT_TRACK_PARTITION_ID, MINIMUM_STATIC_PARTITION_ID)
from textwrap import dedent
@attr(shard=10)
......
......@@ -4,23 +4,26 @@ The container page is used both for displaying units, and
for displaying containers within units.
"""
import datetime
from unittest import skip
import ddt
from nose.plugins.attrib import attr
from unittest import skip
from base_studio_test import ContainerBase
from common.test.acceptance.fixtures.course import XBlockFixtureDesc
from common.test.acceptance.pages.lms.courseware import CoursewarePage
from common.test.acceptance.pages.lms.create_mode import ModeCreationPage
from common.test.acceptance.pages.lms.staff_view import StaffCoursewarePage
from common.test.acceptance.pages.studio.component_editor import ComponentEditorView, ComponentVisibilityEditorView
from common.test.acceptance.pages.studio.container import ContainerPage
from common.test.acceptance.pages.studio.html_component_editor import HtmlComponentEditorView
from common.test.acceptance.pages.studio.move_xblock import MoveModalView
from common.test.acceptance.pages.studio.utils import add_discussion, drag
from common.test.acceptance.pages.lms.courseware import CoursewarePage
from common.test.acceptance.pages.lms.staff_view import StaffCoursewarePage
from common.test.acceptance.tests.helpers import create_user_partition_json
from openedx.core.lib.partitions.partitions import ENROLLMENT_TRACK_PARTITION_ID, MINIMUM_STATIC_PARTITION_ID, Group
from xmodule.partitions.partitions import (
Group, ENROLLMENT_TRACK_PARTITION_ID, MINIMUM_STATIC_PARTITION_ID
)
class NestedVerticalTest(ContainerBase):
......
......@@ -3,9 +3,10 @@
Acceptance tests for Studio's Setting pages
"""
from __future__ import unicode_literals
import os
from textwrap import dedent
from mock import patch
from nose.plugins.attrib import attr
from bok_choy.promise import EmptyPromise
from mock import patch
......@@ -13,15 +14,17 @@ from nose.plugins.attrib import attr
from base_studio_test import StudioCourseTest
from common.test.acceptance.fixtures.course import XBlockFixtureDesc
from common.test.acceptance.pages.common.utils import add_enrollment_course_modes
from common.test.acceptance.pages.lms.courseware import CoursewarePage
from common.test.acceptance.tests.helpers import create_user_partition_json, element_has_text
from common.test.acceptance.pages.studio.overview import CourseOutlinePage
from common.test.acceptance.pages.studio.settings import SettingsPage
from common.test.acceptance.pages.studio.settings_advanced import AdvancedSettingsPage
from common.test.acceptance.pages.studio.settings_group_configurations import GroupConfigurationsPage
from common.test.acceptance.pages.lms.courseware import CoursewarePage
from common.test.acceptance.pages.studio.utils import get_input_value
from common.test.acceptance.tests.helpers import create_user_partition_json, element_has_text
from openedx.core.lib.partitions.partitions import Group
from common.test.acceptance.pages.common.utils import add_enrollment_course_modes
from textwrap import dedent
from xmodule.partitions.partitions import Group
@attr(shard=8)
......
......@@ -4,22 +4,24 @@ Acceptance tests for Studio related to the split_test module.
import math
from unittest import skip
from bok_choy.promise import Promise
from nose.plugins.attrib import attr
from selenium.webdriver.support.ui import Select
from base_studio_test import StudioCourseTest
from xmodule.partitions.partitions import Group
from bok_choy.promise import Promise, EmptyPromise
from common.test.acceptance.fixtures.course import XBlockFixtureDesc
from common.test.acceptance.pages.lms.courseware import CoursewarePage
from common.test.acceptance.pages.studio.component_editor import ComponentEditorView
from common.test.acceptance.pages.studio.container import ContainerPage
from common.test.acceptance.pages.studio.overview import CourseOutlinePage, CourseOutlineUnit
from common.test.acceptance.pages.studio.container import ContainerPage
from common.test.acceptance.pages.studio.settings_group_configurations import GroupConfigurationsPage
from common.test.acceptance.pages.studio.utils import add_advanced_component
from common.test.acceptance.pages.xblock.utils import wait_for_xblock_initialization
from common.test.acceptance.pages.lms.courseware import CoursewarePage
from common.test.acceptance.tests.helpers import create_user_partition_json
from openedx.core.lib.partitions.partitions import Group
from base_studio_test import StudioCourseTest
from test_studio_container import ContainerBase
......
......@@ -9,11 +9,11 @@ import ddt
from nose.plugins.attrib import attr
from openedx.core.djangoapps.models.course_details import CourseDetails
from openedx.core.djangoapps.content.course_overviews.models import CourseOverview
from openedx.core.lib.xblock_fields.inherited_fields import DEFAULT_START_DATE
from rest_framework.test import APIRequestFactory
from rest_framework.request import Request
from xblock.core import XBlock
from xmodule.course_module import DEFAULT_START_DATE
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import check_mongo_calls
......
......@@ -6,7 +6,7 @@ from openedx.core.djangoapps.content.block_structure.transformer import (
FilteringTransformerMixin,
)
from lms.djangoapps.courseware.access_utils import check_start_date
from openedx.core.lib.xblock_fields.inherited_fields import DEFAULT_START_DATE
from xmodule.course_metadata_utils import DEFAULT_START_DATE
from .utils import collect_merged_date_field
......
......@@ -2,11 +2,12 @@
Tests for SplitTestTransformer.
"""
import ddt
import openedx.core.djangoapps.user_api.course_tag.api as course_tag_api
from nose.plugins.attrib import attr
import openedx.core.djangoapps.user_api.course_tag.api as course_tag_api
from openedx.core.djangoapps.user_api.partition_schemes import RandomUserPartitionScheme
from openedx.core.lib.partitions.partitions import Group, UserPartition
from student.tests.factories import CourseEnrollmentFactory
from xmodule.partitions.partitions import Group, UserPartition
from xmodule.modulestore.tests.factories import check_mongo_calls
from ...api import get_course_blocks
......
......@@ -2,17 +2,17 @@
"""
Tests for UserPartitionTransformer.
"""
import string
from collections import namedtuple
import ddt
from nose.plugins.attrib import attr
from openedx.core.djangoapps.course_groups.cohorts import add_user_to_cohort
import string
from openedx.core.djangoapps.course_groups.partition_scheme import CohortPartitionScheme
from openedx.core.djangoapps.course_groups.tests.helpers import CohortFactory, config_course_cohorts
from openedx.core.djangoapps.course_groups.cohorts import add_user_to_cohort
from openedx.core.djangoapps.course_groups.views import link_cohort_to_partition_group
from openedx.core.lib.partitions.partitions import Group, UserPartition
from student.tests.factories import CourseEnrollmentFactory
from xmodule.partitions.partitions import Group, UserPartition
from xmodule.modulestore.tests.factories import CourseFactory
from ...api import get_course_blocks
......
......@@ -3,9 +3,9 @@ User Partitions Transformer
"""
from openedx.core.djangoapps.content.block_structure.transformer import (
BlockStructureTransformer,
FilteringTransformerMixin
FilteringTransformerMixin,
)
from openedx.core.lib.partitions.partitions_service import get_all_partitions_for_course
from xmodule.partitions.partitions_service import get_all_partitions_for_course
from .split_test import SplitTestTransformer
from .utils import get_field_on_block
......
......@@ -10,12 +10,33 @@ Note: The access control logic in this file does NOT check for enrollment in
If enrollment is to be checked, use get_course_with_access in courseware.courses.
It is a wrapper around has_access that additionally checks for enrollment.
"""
import logging
from datetime import datetime
import logging
import pytz
from ccx_keys.locator import CCXLocator
from courseware.access_response import MilestoneError, MobileAvailabilityError, VisibilityError
from django.conf import settings
from django.contrib.auth.models import AnonymousUser
from django.utils.timezone import UTC
from opaque_keys.edx.keys import CourseKey, UsageKey
from util import milestones_helpers as milestones_helpers
from xblock.core import XBlock
from xmodule.course_module import (
CourseDescriptor,
CATALOG_VISIBILITY_CATALOG_AND_ABOUT,
CATALOG_VISIBILITY_ABOUT,
)
from xmodule.error_module import ErrorDescriptor
from xmodule.x_module import XModule
from xmodule.partitions.partitions import NoSuchUserPartitionError, NoSuchUserPartitionGroupError
from courseware.access_response import (
MilestoneError,
MobileAvailabilityError,
VisibilityError,
)
from courseware.access_utils import (
ACCESS_DENIED,
ACCESS_GRANTED,
......@@ -25,16 +46,11 @@ from courseware.access_utils import (
in_preview_mode
)
from courseware.masquerade import get_masquerade_role, is_masquerading_as_student
from django.conf import settings
from django.contrib.auth.models import AnonymousUser
from django.utils.timezone import UTC
from lms.djangoapps.ccx.custom_exception import CCXLocatorValidationException
from lms.djangoapps.ccx.models import CustomCourseForEdX
from mobile_api.models import IgnoreMobileAvailableFlagConfig
from opaque_keys.edx.keys import CourseKey, UsageKey
from openedx.core.djangoapps.content.course_overviews.models import CourseOverview
from openedx.core.djangoapps.external_auth.models import ExternalAuthMap
from openedx.core.lib.partitions.partitions import NoSuchUserPartitionError, NoSuchUserPartitionGroupError
from student import auth
from student.models import CourseEnrollmentAllowed
from student.roles import (
......@@ -43,20 +59,16 @@ from student.roles import (
CourseInstructorRole,
CourseStaffRole,
GlobalStaff,
SupportStaffRole,
OrgInstructorRole,
OrgStaffRole,
SupportStaffRole
)
from util import milestones_helpers as milestones_helpers
from util.milestones_helpers import (
any_unfulfilled_milestones,
get_pre_requisite_courses_not_completed,
is_prerequisite_courses_enabled
any_unfulfilled_milestones,
is_prerequisite_courses_enabled,
)
from xblock.core import XBlock
from xmodule.course_module import CATALOG_VISIBILITY_ABOUT, CATALOG_VISIBILITY_CATALOG_AND_ABOUT, CourseDescriptor
from xmodule.error_module import ErrorDescriptor
from xmodule.x_module import XModule
from ccx_keys.locator import CCXLocator
log = logging.getLogger(__name__)
......
......@@ -3,7 +3,7 @@ This file contains all the classes used by has_access for error handling
"""
from django.utils.translation import ugettext as _
from openedx.core.lib.xblock_fields.inherited_fields import DEFAULT_START_DATE
from xmodule.course_metadata_utils import DEFAULT_START_DATE
class AccessResponse(object):
......
......@@ -14,15 +14,17 @@ package and is used to wrap the `authored_data` when constructing an
`LmsFieldData`. This means overrides will be in effect for all scopes covered
by `authored_data`, e.g. course content and settings stored in Mongo.
"""
import threading
from abc import ABCMeta, abstractmethod
from contextlib import contextmanager
import threading
from django.conf import settings
from openedx.core.lib.xblock_fields.inherited_fields import InheritanceMixin
from request_cache.middleware import RequestCache
from xblock.field_data import FieldData
from request_cache.middleware import RequestCache
from xmodule.modulestore.inheritance import InheritanceMixin
NOTSET = object()
ENABLED_OVERRIDE_PROVIDERS_KEY = u'courseware.field_overrides.enabled_providers.{course_id}'
ENABLED_MODULESTORE_OVERRIDE_PROVIDERS_KEY = u'courseware.modulestore_field_overrides.enabled_providers.{course_id}'
......
......@@ -11,12 +11,14 @@ from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.utils.translation import ugettext as _
from django.views.decorators.http import require_POST
from opaque_keys.edx.keys import CourseKey
from openedx.core.lib.partitions.partitions import NoSuchUserPartitionGroupError
from student.models import CourseEnrollment
from util.json_request import JsonResponse, expect_json
from util.json_request import expect_json, JsonResponse
from opaque_keys.edx.keys import CourseKey
from xblock.fragment import Fragment
from xblock.runtime import KeyValueStore
from xmodule.partitions.partitions import NoSuchUserPartitionGroupError
log = logging.getLogger(__name__)
......
......@@ -3,60 +3,66 @@
Test the access control framework
"""
import datetime
import ddt
import itertools
import pytz
from django.contrib.auth.models import User
from ccx_keys.locator import CCXLocator
from django.test.client import RequestFactory
from django.core.urlresolvers import reverse
from django.test import TestCase
from mock import Mock, patch
from nose.plugins.attrib import attr
from opaque_keys.edx.locations import SlashSeparatedCourseKey
from ccx.tests.factories import CcxFactory
import courseware.access as access
import courseware.access_response as access_response
import ddt
import pytz
from ccx.tests.factories import CcxFactory
from ccx_keys.locator import CCXLocator
from courseware.masquerade import CourseMasquerade
from courseware.tests.factories import (
BetaTesterFactory,
GlobalStaffFactory,
InstructorFactory,
StaffFactory,
UserFactory
UserFactory,
)
from courseware.tests.helpers import LoginEnrollmentTestCase, masquerade_as_group_member
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.test.client import RequestFactory
from lms.djangoapps.ccx.models import CustomCourseForEdX
from milestones.tests.utils import MilestonesTestCaseMixin
from mock import Mock, patch
from nose.plugins.attrib import attr
from opaque_keys.edx.locations import SlashSeparatedCourseKey
from openedx.core.djangoapps.content.course_overviews.models import CourseOverview
from openedx.core.lib.partitions.partitions import MINIMUM_STATIC_PARTITION_ID, Group, UserPartition
from student.models import CourseEnrollment
from student.roles import CourseCcxCoachRole, CourseStaffRole
from student.tests.factories import (
AdminFactory,
AnonymousUserFactory,
CourseEnrollmentAllowedFactory,
CourseEnrollmentFactory
CourseEnrollmentFactory,
)
from util.milestones_helpers import fulfill_course_milestone, set_prerequisite_courses
from xmodule.course_module import (
CATALOG_VISIBILITY_ABOUT,
CATALOG_VISIBILITY_CATALOG_AND_ABOUT,
CATALOG_VISIBILITY_NONE
CATALOG_VISIBILITY_ABOUT,
CATALOG_VISIBILITY_NONE,
)
from xmodule.error_module import ErrorDescriptor
from xmodule.partitions.partitions import Group, UserPartition, MINIMUM_STATIC_PARTITION_ID
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from xmodule.modulestore.tests.django_utils import (
TEST_DATA_SPLIT_MODULESTORE,
ModuleStoreTestCase,
SharedModuleStoreTestCase
SharedModuleStoreTestCase,
TEST_DATA_SPLIT_MODULESTORE
)
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from xmodule.modulestore.xml import CourseLocationManager
from xmodule.tests import get_test_system
from util.milestones_helpers import (
set_prerequisite_courses,
fulfill_course_milestone,
)
from milestones.tests.utils import MilestonesTestCaseMixin
from lms.djangoapps.ccx.models import CustomCourseForEdX
# pylint: disable=protected-access
......
......@@ -3,15 +3,17 @@ This module defines tests for courseware.access that are specific to group
access control rules.
"""
import courseware.access as access
import ddt
from courseware.tests.factories import StaffFactory, UserFactory
from nose.plugins.attrib import attr
from openedx.core.lib.partitions.partitions import USER_PARTITION_SCHEME_NAMESPACE, Group, UserPartition
from stevedore.extension import Extension, ExtensionManager
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from xmodule.partitions.partitions import Group, UserPartition, USER_PARTITION_SCHEME_NAMESPACE
from xmodule.modulestore.django import modulestore
import courseware.access as access
from courseware.tests.factories import StaffFactory, UserFactory
class MemoryUserPartitionScheme(object):
......
......@@ -3,31 +3,32 @@ Unit tests for masquerade.
"""
import json
import pickle
from mock import patch
from nose.plugins.attrib import attr
from datetime import datetime
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.utils.timezone import UTC
from capa.tests.response_xml_factory import OptionResponseXMLFactory
from courseware.masquerade import (
CourseMasquerade,
MasqueradingKeyValueStore,
get_masquerading_user_group,
handle_ajax,
setup_masquerade
setup_masquerade,
get_masquerading_user_group
)
from courseware.tests.factories import StaffFactory
from courseware.tests.helpers import LoginEnrollmentTestCase, masquerade_as_group_member
from courseware.tests.test_submitting_problems import ProblemSubmissionTestMixin
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.utils.timezone import UTC
from mock import patch
from nose.plugins.attrib import attr
from openedx.core.djangoapps.self_paced.models import SelfPacedConfiguration
from openedx.core.lib.partitions.partitions import Group, UserPartition
from student.tests.factories import UserFactory
from xblock.runtime import DictKeyValueStore
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 ItemFactory, CourseFactory
from xmodule.partitions.partitions import Group, UserPartition
from openedx.core.djangoapps.self_paced.models import SelfPacedConfiguration
class MasqueradeTestCase(SharedModuleStoreTestCase, LoginEnrollmentTestCase):
......
"""
Test for split test XModule
"""
from courseware.model_data import FieldDataCache
from courseware.module_render import get_module_for_descriptor
from django.core.urlresolvers import reverse
from mock import MagicMock
from nose.plugins.attrib import attr
from openedx.core.djangoapps.user_api.tests.factories import UserCourseTagFactory
from openedx.core.lib.partitions.partitions import Group, UserPartition
from student.tests.factories import CourseEnrollmentFactory, UserFactory
from courseware.module_render import get_module_for_descriptor
from courseware.model_data import FieldDataCache
from student.tests.factories import UserFactory, CourseEnrollmentFactory
from xmodule.modulestore.tests.factories import ItemFactory, CourseFactory
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from xmodule.partitions.partitions import Group, UserPartition
from openedx.core.djangoapps.user_api.tests.factories import UserCourseTagFactory
@attr(shard=1)
......
......@@ -10,33 +10,34 @@ import os
from textwrap import dedent
import ddt
from capa.tests.response_xml_factory import (
CodeResponseXMLFactory,
CustomResponseXMLFactory,
OptionResponseXMLFactory,
SchematicResponseXMLFactory
)
from course_modes.models import CourseMode
from courseware.models import BaseStudentModuleHistory, StudentModule
from courseware.tests.helpers import LoginEnrollmentTestCase
from django.conf import settings
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.test.client import RequestFactory
from django.utils.timezone import now
from lms.djangoapps.grades.new.course_grade_factory import CourseGradeFactory
from mock import patch
from nose.plugins.attrib import attr
from openedx.core.djangoapps.credit.api import get_credit_requirement_status, set_credit_requirements
from capa.tests.response_xml_factory import (
OptionResponseXMLFactory, CustomResponseXMLFactory, SchematicResponseXMLFactory,
CodeResponseXMLFactory,
)
from course_modes.models import CourseMode
from courseware.models import StudentModule, BaseStudentModuleHistory
from courseware.tests.helpers import LoginEnrollmentTestCase
from lms.djangoapps.grades.new.course_grade_factory import CourseGradeFactory
from openedx.core.djangoapps.credit.api import (
set_credit_requirements, get_credit_requirement_status
)
from openedx.core.djangoapps.credit.models import CreditCourse, CreditProvider
from openedx.core.djangoapps.user_api.tests.factories import UserCourseTagFactory
from openedx.core.lib.partitions.partitions import Group, UserPartition
from openedx.core.lib.url_utils import quote_slashes
from student.models import CourseEnrollment, anonymous_id_for_user
from student.models import anonymous_id_for_user, CourseEnrollment
from submissions import api as submissions_api
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from xmodule.partitions.partitions import Group, UserPartition
class ProblemSubmissionTestMixin(TestCase):
......
"""
Tests for Discussion API internal interface
"""
import itertools
from datetime import datetime, timedelta
from urllib import urlencode
import itertools
from urlparse import parse_qs, urlparse, urlunparse
from urllib import urlencode
import ddt
import httpretty
import mock
from nose.plugins.attrib import attr
from pytz import UTC
from django.core.exceptions import ValidationError
from django.test.client import RequestFactory
from rest_framework.exceptions import PermissionDenied
from opaque_keys.edx.locator import CourseLocator
from common.test.utils import MockSignalHandlerMixin, disable_signal
from courseware.tests.factories import BetaTesterFactory, StaffFactory
from discussion_api import api
......@@ -20,41 +30,35 @@ from discussion_api.api import (
get_comment_list,
get_course,
get_course_topics,
get_thread,
get_thread_list,
update_comment,
update_thread
update_thread,
get_thread,
)
from discussion_api.exceptions import CommentNotFoundError, DiscussionDisabledError, ThreadNotFoundError
from discussion_api.exceptions import DiscussionDisabledError, ThreadNotFoundError, CommentNotFoundError
from discussion_api.tests.utils import (
CommentsServiceMockMixin,
make_minimal_cs_comment,
make_minimal_cs_thread,
make_paginated_api_response
make_paginated_api_response,
)
from django.core.exceptions import ValidationError
from django.test.client import RequestFactory
from django_comment_client.tests.utils import ForumsEnableMixin
from django_comment_common.models import (
FORUM_ROLE_ADMINISTRATOR,
FORUM_ROLE_COMMUNITY_TA,
FORUM_ROLE_MODERATOR,
FORUM_ROLE_STUDENT,
Role
Role,
)
from nose.plugins.attrib import attr
from opaque_keys.edx.locator import CourseLocator
from django_comment_client.tests.utils import ForumsEnableMixin
from openedx.core.djangoapps.course_groups.models import CourseUserGroupPartitionGroup
from openedx.core.djangoapps.course_groups.tests.helpers import CohortFactory
from openedx.core.lib.exceptions import CourseNotFoundError, PageNotFoundError
from openedx.core.lib.partitions.partitions import Group, UserPartition
from pytz import UTC
from rest_framework.exceptions import PermissionDenied
from student.tests.factories import CourseEnrollmentFactory, UserFactory
from util.testing import UrlResetMixin
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase, SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from xmodule.partitions.partitions import Group, UserPartition
def _remove_discussion_tab(course, user_id):
......
......@@ -3,30 +3,15 @@
Unit tests for instructor.api methods.
"""
import datetime
import ddt
import functools
import random
import pytz
import io
import json
import random
import shutil
import tempfile
import ddt
import lms.djangoapps.instructor.views.api
import lms.djangoapps.instructor_task.api
import pytz
from bulk_email.models import BulkEmailFlag, CourseEmail, CourseEmailTemplate
from certificates.models import CertificateStatuses
from certificates.tests.factories import GeneratedCertificateFactory
from course_modes.models import CourseMode
from courseware.models import StudentFieldOverride, StudentModule
from courseware.tests.factories import (
BetaTesterFactory,
GlobalStaffFactory,
InstructorFactory,
StaffFactory,
UserProfileFactory
)
from courseware.tests.helpers import LoginEnrollmentTestCase
from django.conf import settings
from django.contrib.auth.models import User
from django.core import mail
......@@ -37,56 +22,55 @@ from django.test import RequestFactory, TestCase
from django.test.utils import override_settings
from django.utils.timezone import utc
from django.utils.translation import ugettext as _
from django_comment_common.models import FORUM_ROLE_COMMUNITY_TA
from django_comment_common.utils import seed_permissions_roles
from lms.djangoapps.instructor.tests.utils import FakeContentTask, FakeEmail, FakeEmailInfo
from lms.djangoapps.instructor.views.api import (
_split_input_list,
common_exceptions_400,
generate_unique_password,
require_finance_admin
)
from lms.djangoapps.instructor_task.api_helper import AlreadyRunningError
from mock import Mock, patch
from nose.plugins.attrib import attr
from nose.tools import raises
from nose.plugins.attrib import attr
from opaque_keys.edx.locations import SlashSeparatedCourseKey
from opaque_keys.edx.locator import UsageKey
from openedx.core.djangoapps.course_groups.cohorts import set_course_cohort_settings
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
from openedx.core.djangoapps.site_configuration.tests.mixins import SiteMixin
from openedx.core.lib.xblock_fields.fields import Date
from openedx.core.lib.xblock_utils import grade_histogram
from shoppingcart.models import (
Coupon,
CouponRedemption,
CourseRegistrationCode,
CourseRegistrationCodeInvoiceItem,
Invoice,
InvoiceTransaction,
Order,
PaidCourseRegistration,
RegistrationCodeRedemption
from xmodule.modulestore import ModuleStoreEnum
from bulk_email.models import BulkEmailFlag, CourseEmail, CourseEmailTemplate
from course_modes.models import CourseMode
from courseware.models import StudentModule
from courseware.tests.factories import (
BetaTesterFactory, GlobalStaffFactory, InstructorFactory, StaffFactory, UserProfileFactory
)
from courseware.tests.helpers import LoginEnrollmentTestCase
from django_comment_common.models import FORUM_ROLE_COMMUNITY_TA
from django_comment_common.utils import seed_permissions_roles
from shoppingcart.models import (
RegistrationCodeRedemption, Order, CouponRedemption,
PaidCourseRegistration, Coupon, Invoice, CourseRegistrationCode, CourseRegistrationCodeInvoiceItem,
InvoiceTransaction)
from shoppingcart.pdf import PDFInvoice
from student.models import (
ALLOWEDTOENROLL_TO_ENROLLED,
ALLOWEDTOENROLL_TO_UNENROLLED,
ENROLLED_TO_ENROLLED,
ENROLLED_TO_UNENROLLED,
UNENROLLED_TO_ALLOWEDTOENROLL,
UNENROLLED_TO_ENROLLED,
UNENROLLED_TO_UNENROLLED,
CourseEnrollment,
CourseEnrollmentAllowed,
ManualEnrollmentAudit,
NonExistentCourseError
CourseEnrollment, CourseEnrollmentAllowed, NonExistentCourseError,
ManualEnrollmentAudit, UNENROLLED_TO_ENROLLED, ENROLLED_TO_UNENROLLED,
ALLOWEDTOENROLL_TO_UNENROLLED, ENROLLED_TO_ENROLLED, UNENROLLED_TO_ALLOWEDTOENROLL,
UNENROLLED_TO_UNENROLLED, ALLOWEDTOENROLL_TO_ENROLLED
)
from student.roles import CourseBetaTesterRole, CourseFinanceAdminRole, CourseInstructorRole, CourseSalesAdminRole
from student.tests.factories import AdminFactory, CourseModeFactory, UserFactory
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase, SharedModuleStoreTestCase
from student.tests.factories import UserFactory, CourseModeFactory, AdminFactory
from student.roles import CourseBetaTesterRole, CourseSalesAdminRole, CourseFinanceAdminRole, CourseInstructorRole
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase, ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from xmodule.fields import Date
from courseware.models import StudentFieldOverride
import lms.djangoapps.instructor_task.api
import lms.djangoapps.instructor.views.api
from lms.djangoapps.instructor.views.api import require_finance_admin
from lms.djangoapps.instructor.tests.utils import FakeContentTask, FakeEmail, FakeEmailInfo
from lms.djangoapps.instructor.views.api import _split_input_list, common_exceptions_400, generate_unique_password
from lms.djangoapps.instructor_task.api_helper import AlreadyRunningError
from certificates.tests.factories import GeneratedCertificateFactory
from certificates.models import CertificateStatuses
from openedx.core.djangoapps.course_groups.cohorts import set_course_cohort_settings
from openedx.core.lib.xblock_utils import grade_histogram
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
from openedx.core.djangoapps.site_configuration.tests.mixins import SiteMixin
from .test_tools import msk_from_problem_urlname
......
......@@ -3,20 +3,21 @@ Tests for views/tools.py.
"""
import datetime
import mock
import json
import unittest
import mock
from courseware.field_overrides import OverrideFieldData
from django.test.utils import override_settings
from django.utils.timezone import utc
from lms.djangoapps.ccx.tests.test_overrides import inject_field_overrides
from django.test.utils import override_settings
from nose.plugins.attrib import attr
from opaque_keys.edx.keys import CourseKey
from openedx.core.lib.xblock_fields.fields import Date
from courseware.field_overrides import OverrideFieldData
from lms.djangoapps.ccx.tests.test_overrides import inject_field_overrides
from student.tests.factories import UserFactory
from xmodule.fields import Date
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase, SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from opaque_keys.edx.keys import CourseKey
from ..views import tools
......
"""
Tools for the instructor dashboard
"""
import dateutil
import json
import dateutil
from courseware.field_overrides import disable_overrides
from courseware.models import StudentFieldOverride
from courseware.student_field_overrides import clear_override_for_user, get_override_for_user, override_field_for_user
from django.contrib.auth.models import User
from django.http import HttpResponseBadRequest
from django.utils.timezone import utc
from django.utils.translation import ugettext as _
from courseware.models import StudentFieldOverride
from courseware.field_overrides import disable_overrides
from courseware.student_field_overrides import (
clear_override_for_user,
get_override_for_user,
override_field_for_user,
)
from xmodule.fields import Date
from opaque_keys.edx.keys import UsageKey
from openedx.core.lib.xblock_fields.fields import Date
DATE_FIELD = Date()
......
"""
Functionality for generating grade reports.
"""
import logging
import re
from collections import OrderedDict
from datetime import datetime
from itertools import chain, izip, izip_longest
from itertools import chain, izip_longest, izip
from lazy import lazy
import logging
from pytz import UTC
import re
from time import time
from certificates.models import CertificateWhitelist, GeneratedCertificate, certificate_info_for_user
from courseware.courses import get_course_by_id
from instructor_analytics.basic import list_problem_responses
from instructor_analytics.csvs import format_dictlist
from lazy import lazy
from lms.djangoapps.grades.context import grading_context, grading_context_for_course
from lms.djangoapps.grades.models import PersistentCourseGrade
from certificates.models import CertificateWhitelist, certificate_info_for_user, GeneratedCertificate
from courseware.courses import get_course_by_id
from lms.djangoapps.grades.context import grading_context_for_course, grading_context
from lms.djangoapps.grades.new.course_grade_factory import CourseGradeFactory
from lms.djangoapps.grades.models import PersistentCourseGrade
from lms.djangoapps.teams.models import CourseTeamMembership
from lms.djangoapps.verify_student.models import SoftwareSecurePhotoVerification
from openedx.core.djangoapps.content.block_structure.api import get_course_in_cache
from openedx.core.djangoapps.course_groups.cohorts import bulk_cache_cohorts, get_cohort, is_course_cohorted
from openedx.core.djangoapps.course_groups.cohorts import get_cohort, is_course_cohorted, bulk_cache_cohorts
from openedx.core.djangoapps.user_api.course_tag.api import BulkCourseTags
from openedx.core.lib.partitions.partitions_service import PartitionService
from pytz import UTC
from student.models import CourseEnrollment
from student.roles import BulkRoleCache
from xmodule.modulestore.django import modulestore
from xmodule.partitions.partitions_service import PartitionService
from xmodule.split_test_module import get_split_user_partitions
from .runner import TaskProgress
from .utils import upload_csv_to_report_store
TASK_LOG = logging.getLogger('edx.celery.task')
......
......@@ -10,73 +10,79 @@ Unit tests for LMS instructor-initiated background tasks helper functions.
import os
import shutil
import tempfile
import urllib
from datetime import datetime
import urllib
from django.conf import settings
from django.core.urlresolvers import reverse
from django.test.utils import override_settings
import ddt
import openedx.core.djangoapps.user_api.course_tag.api as course_tag_api
from freezegun import freeze_time
from mock import Mock, patch, MagicMock
from nose.plugins.attrib import attr
from pytz import UTC
import tempfile
import unicodecsv
from capa.tests.response_xml_factory import MultipleChoiceResponseXMLFactory
from certificates.models import CertificateStatuses, GeneratedCertificate
from certificates.tests.factories import CertificateWhitelistFactory, GeneratedCertificateFactory
from certificates.tests.factories import GeneratedCertificateFactory, CertificateWhitelistFactory
from course_modes.models import CourseMode
from courseware.tests.factories import InstructorFactory
from django.conf import settings
from django.core.urlresolvers import reverse
from django.test.utils import override_settings
from freezegun import freeze_time
from instructor_analytics.basic import UNAVAILABLE
from lms.djangoapps.grades.models import PersistentCourseGrade
from lms.djangoapps.grades.transformer import GradesTransformer
from lms.djangoapps.instructor_task.tasks_helper.certs import generate_students_certificates
from lms.djangoapps.instructor_task.tasks_helper.enrollments import (
upload_enrollment_report,
upload_exec_summary_report,
upload_may_enroll_csv,
upload_students_csv
)
from lms.djangoapps.instructor_task.tasks_helper.grades import CourseGradeReport, ProblemGradeReport, ProblemResponses
from lms.djangoapps.instructor_task.tasks_helper.misc import (
cohort_students_and_upload,
upload_course_survey_report,
upload_ora2_data
)
from lms.djangoapps.instructor_task.tests.test_base import (
InstructorTaskCourseTestCase,
InstructorTaskModuleTestCase,
TestReportMixin
)
from lms.djangoapps.teams.tests.factories import CourseTeamFactory, CourseTeamMembershipFactory
from lms.djangoapps.verify_student.tests.factories import SoftwareSecurePhotoVerificationFactory
from mock import MagicMock, Mock, patch
from nose.plugins.attrib import attr
from openedx.core.djangoapps.course_groups.models import CohortMembership, CourseUserGroupPartitionGroup
from openedx.core.djangoapps.course_groups.models import CourseUserGroupPartitionGroup, CohortMembership
from openedx.core.djangoapps.course_groups.tests.helpers import CohortFactory
from openedx.core.djangoapps.credit.tests.factories import CreditCourseFactory
import openedx.core.djangoapps.user_api.course_tag.api as course_tag_api
from openedx.core.djangoapps.user_api.partition_schemes import RandomUserPartitionScheme
from openedx.core.djangoapps.util.testing import ContentGroupTestCase, TestConditionalContent
from openedx.core.lib.partitions.partitions import Group, UserPartition
from pytz import UTC
from request_cache.middleware import RequestCache
from shoppingcart.models import (
Coupon,
CourseRegistrationCode,
CourseRegistrationCodeInvoiceItem,
Invoice,
InvoiceTransaction,
Order,
PaidCourseRegistration
Order, PaidCourseRegistration, CourseRegistrationCode, Invoice,
CourseRegistrationCodeInvoiceItem, InvoiceTransaction, Coupon
)
from student.models import ALLOWEDTOENROLL_TO_ENROLLED, CourseEnrollment, CourseEnrollmentAllowed, ManualEnrollmentAudit
from student.models import CourseEnrollment, CourseEnrollmentAllowed, ManualEnrollmentAudit, ALLOWEDTOENROLL_TO_ENROLLED
from student.tests.factories import CourseEnrollmentFactory, CourseModeFactory, UserFactory
from survey.models import SurveyAnswer, SurveyForm
from survey.models import SurveyForm, SurveyAnswer
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory, check_mongo_calls
from xmodule.partitions.partitions import Group, UserPartition
from ..models import ReportStore
from ..tasks_helper.utils import UPDATE_STATUS_FAILED, UPDATE_STATUS_SUCCEEDED
from lms.djangoapps.instructor_task.tasks_helper.certs import (
generate_students_certificates,
)
from lms.djangoapps.instructor_task.tasks_helper.enrollments import (
upload_enrollment_report,
upload_may_enroll_csv,
upload_exec_summary_report,
upload_students_csv,
)
from lms.djangoapps.instructor_task.tasks_helper.grades import (
CourseGradeReport,
ProblemGradeReport,
ProblemResponses,
)
from lms.djangoapps.instructor_task.tasks_helper.misc import (
cohort_students_and_upload,
upload_course_survey_report,
upload_ora2_data,
)
from ..tasks_helper.utils import (
UPDATE_STATUS_FAILED,
UPDATE_STATUS_SUCCEEDED,
)
from lms.djangoapps.instructor_task.tests.test_base import (
InstructorTaskCourseTestCase,
TestReportMixin,
InstructorTaskModuleTestCase
)
class InstructorGradeReportTestCase(TestReportMixin, InstructorTaskCourseTestCase):
......
......@@ -4,11 +4,12 @@ Namespace that defines fields common to all blocks used in the LMS
#from django.utils.translation import ugettext_noop as _
from lazy import lazy
from openedx.core.lib.partitions.partitions import NoSuchUserPartitionError, NoSuchUserPartitionGroupError
from openedx.core.lib.xblock_fields.inherited_fields import UserPartitionList
from xblock.core import XBlock
from xblock.fields import Boolean, Dict, Scope, String, XBlockMixin
from xblock.fields import Boolean, Scope, String, XBlockMixin, Dict
from xblock.validation import ValidationMessage
from xmodule.modulestore.inheritance import UserPartitionList
from xmodule.partitions.partitions import NoSuchUserPartitionError, NoSuchUserPartitionGroupError
# Please do not remove, this is a workaround for Django 1.8.
# more information can be found here: https://openedx.atlassian.net/browse/PLAT-902
......
"""
Module implementing `xblock.runtime.Runtime` functionality for the LMS
"""
import xblock.reference.plugins
from badges.service import BadgingService
from badges.utils import badges_enabled
from django.conf import settings
from django.core.urlresolvers import reverse
from lms.djangoapps.lms_xblock.models import XBlockAsidesConfig
from badges.service import BadgingService
from badges.utils import badges_enabled
from openedx.core.djangoapps.user_api.course_tag import api as user_course_tag_api
from openedx.core.lib.partitions.partitions_service import PartitionService
from openedx.core.lib.url_utils import quote_slashes
from openedx.core.lib.xblock_utils import xblock_local_resource_url
from openedx.core.lib.url_utils import quote_slashes
from request_cache.middleware import RequestCache
import xblock.reference.plugins
from xmodule.library_tools import LibraryToolsService
from xmodule.modulestore.django import ModuleI18nService, modulestore
from xmodule.modulestore.django import modulestore, ModuleI18nService
from xmodule.partitions.partitions_service import PartitionService
from xmodule.services import SettingsService
from xmodule.x_module import ModuleSystem
from lms.djangoapps.lms_xblock.models import XBlockAsidesConfig
def handler_url(block, handler_name, suffix='', query='', thirdparty=False):
"""
......
......@@ -13,6 +13,7 @@ from django.utils import timezone
from django.template import defaultfilters
from django.test import RequestFactory, override_settings
from milestones.tests.utils import MilestonesTestCaseMixin
from xmodule.course_module import DEFAULT_START_DATE
from xmodule.modulestore.tests.factories import ItemFactory, CourseFactory
from certificates.api import generate_user_certificates
......@@ -26,7 +27,6 @@ from courseware.access_response import (
from course_modes.models import CourseMode
from lms.djangoapps.grades.tests.utils import mock_passing_grade
from openedx.core.lib.courses import course_image_url
from openedx.core.lib.xblock_fields.inherited_fields import DEFAULT_START_DATE
from student.models import CourseEnrollment
from util.milestones_helpers import set_prerequisite_courses
from util.testing import UrlResetMixin
......
......@@ -4,22 +4,23 @@ Tests for video outline API
"""
import itertools
from collections import namedtuple
from uuid import uuid4
from collections import namedtuple
import ddt
from nose.plugins.attrib import attr
from edxval import api
from xmodule.modulestore.tests.factories import ItemFactory
from xmodule.video_module import transcripts_utils
from xmodule.modulestore.django import modulestore
from xmodule.partitions.partitions import Group, UserPartition
from milestones.tests.utils import MilestonesTestCaseMixin
from mobile_api.models import MobileApiConfig
from mobile_api.testutils import MobileAPITestCase, MobileAuthTestMixin, MobileCourseAccessTestMixin
from nose.plugins.attrib import attr
from openedx.core.djangoapps.course_groups.cohorts import add_user_to_cohort, remove_user_from_cohort
from openedx.core.djangoapps.course_groups.models import CourseUserGroupPartitionGroup
from openedx.core.djangoapps.course_groups.tests.helpers import CohortFactory
from openedx.core.lib.partitions.partitions import Group, UserPartition
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.tests.factories import ItemFactory
from xmodule.video_module import transcripts_utils
from openedx.core.djangoapps.course_groups.models import CourseUserGroupPartitionGroup
from openedx.core.djangoapps.course_groups.cohorts import add_user_to_cohort, remove_user_from_cohort
from mobile_api.testutils import MobileAPITestCase, MobileAuthTestMixin, MobileCourseAccessTestMixin
class TestVideoAPITestCase(MobileAPITestCase):
......
......@@ -731,7 +731,7 @@ VIRTUAL_UNIVERSITIES = []
############# XBlock Configuration ##########
# Import after sys.path fixup
from openedx.core.lib.xblock_fields.inherited_fields import InheritanceMixin
from xmodule.modulestore.inheritance import InheritanceMixin
from xmodule.modulestore import prefer_xmodules
from xmodule.x_module import XModuleMixin
......
......@@ -2,13 +2,14 @@
Tests of the LMS XBlock Mixin
"""
import ddt
from lms_xblock.mixin import INVALID_USER_PARTITION_GROUP_VALIDATION, INVALID_USER_PARTITION_VALIDATION
from nose.plugins.attrib import attr
from openedx.core.lib.partitions.partitions import Group, UserPartition
from lms_xblock.mixin import INVALID_USER_PARTITION_VALIDATION, INVALID_USER_PARTITION_GROUP_VALIDATION
from xblock.validation import ValidationMessage
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.tests.django_utils import TEST_DATA_MIXED_MODULESTORE, ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory, ToyCourseFactory
from xmodule.modulestore.tests.factories import CourseFactory, ToyCourseFactory, ItemFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase, TEST_DATA_MIXED_MODULESTORE
from xmodule.partitions.partitions import Group, UserPartition
class LmsXBlockMixinTestCase(ModuleStoreTestCase):
......
......@@ -7,7 +7,7 @@ from django.utils.translation import ugettext as _
from django.conf import settings
from openedx.core.djangolib.js_utils import dump_js_escaped_json
from openedx.core.djangolib.markup import HTML, Text
from openedx.core.lib.partitions.partitions_service import get_all_partitions_for_course
from xmodule.partitions.partitions_service import get_all_partitions_for_course
%>
<%
......
......@@ -20,11 +20,10 @@ from lms.djangoapps import django_comment_client
from openedx.core.djangoapps.models.course_details import CourseDetails
from static_replace.models import AssetBaseUrlConfig
from xmodule import course_metadata_utils, block_metadata_utils
from xmodule.course_module import CourseDescriptor
from xmodule.course_module import CourseDescriptor, DEFAULT_START_DATE
from xmodule.error_module import ErrorDescriptor
from xmodule.modulestore.django import modulestore
from openedx.core.djangoapps.xmodule_django.models import CourseKeyField, UsageKeyField
from openedx.core.lib.xblock_fields.inherited_fields import DEFAULT_START_DATE
log = logging.getLogger(__name__)
......
......@@ -19,11 +19,11 @@ from PIL import Image
from lms.djangoapps.certificates.api import get_active_web_certificate
from openedx.core.djangoapps.models.course_details import CourseDetails
from openedx.core.lib.courses import course_image_url
from openedx.core.lib.xblock_fields.inherited_fields import DEFAULT_START_DATE
from static_replace.models import AssetBaseUrlConfig
from xmodule.assetstore.assetmgr import AssetManager
from xmodule.contentstore.django import contentstore
from xmodule.contentstore.content import StaticContent
from xmodule.course_metadata_utils import DEFAULT_START_DATE
from xmodule.course_module import (
CATALOG_VISIBILITY_CATALOG_AND_ABOUT,
CATALOG_VISIBILITY_ABOUT,
......
......@@ -8,10 +8,11 @@ from courseware.masquerade import ( # pylint: disable=import-error
get_masquerading_user_group,
is_masquerading_as_specific_student
)
from openedx.core.lib.partitions.partitions import NoSuchUserPartitionGroupError
from xmodule.partitions.partitions import NoSuchUserPartitionGroupError
from .cohorts import get_cohort, get_group_info_for_cohort
log = logging.getLogger(__name__)
......
......@@ -3,21 +3,22 @@ Test the partitions and partitions service
"""
import django.test
from courseware.tests.test_masquerade import StaffMasqueradeTestCase
from mock import patch
from nose.plugins.attrib import attr
from openedx.core.djangoapps.user_api.partition_schemes import RandomUserPartitionScheme
from openedx.core.djangolib.testing.utils import skip_unless_lms
from openedx.core.lib.partitions.partitions import Group, UserPartition, UserPartitionError
from courseware.tests.test_masquerade import StaffMasqueradeTestCase
from student.tests.factories import UserFactory
from xmodule.partitions.partitions import Group, UserPartition, UserPartitionError
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.tests.django_utils import TEST_DATA_MIXED_MODULESTORE, ModuleStoreTestCase
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase, TEST_DATA_MIXED_MODULESTORE
from xmodule.modulestore.tests.factories import ToyCourseFactory
from ..cohorts import add_user_to_cohort, get_course_cohorts, remove_user_from_cohort
from ..models import CourseUserGroupPartitionGroup
from openedx.core.djangoapps.user_api.partition_schemes import RandomUserPartitionScheme
from openedx.core.djangolib.testing.utils import skip_unless_lms
from ..partition_scheme import CohortPartitionScheme, get_cohorted_user_partition
from ..models import CourseUserGroupPartitionGroup
from ..views import link_cohort_to_partition_group, unlink_cohort_partition_group
from ..cohorts import add_user_to_cohort, remove_user_from_cohort, get_course_cohorts
from .helpers import CohortFactory, config_course_cohorts
......
"""
CourseDetails
"""
import logging
import re
import logging
from django.conf import settings
from xmodule.fields import Date
from xmodule.modulestore.exceptions import ItemNotFoundError
from openedx.core.djangoapps.self_paced.models import SelfPacedConfiguration
from openedx.core.lib.courses import course_image_url
from openedx.core.lib.xblock_fields.fields import Date
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.exceptions import ItemNotFoundError
# This list represents the attribute keys for a course's 'about' info.
# Note: The 'video' attribute is intentionally excluded as it must be
......
......@@ -3,9 +3,9 @@ Provides partition support to the user service.
"""
import logging
import random
import course_tag.api as course_tag_api
from openedx.core.lib.partitions.partitions import NoSuchUserPartitionGroupError, UserPartitionError
from xmodule.partitions.partitions import UserPartitionError, NoSuchUserPartitionGroupError
log = logging.getLogger(__name__)
......
......@@ -2,13 +2,13 @@
Test the user api's partition extensions.
"""
from collections import defaultdict
from mock import patch
from unittest import TestCase
from mock import patch
from openedx.core.djangoapps.user_api.partition_schemes import RandomUserPartitionScheme, UserPartitionError
from openedx.core.lib.partitions.partitions import Group, UserPartition
from openedx.core.lib.partitions.tests.test_partitions import PartitionTestCase
from student.tests.factories import UserFactory
from xmodule.partitions.partitions import Group, UserPartition
from xmodule.partitions.tests.test_partitions import PartitionTestCase
class MemoryCourseTagAPI(object):
......
""" Mixins for setting up particular course structures (such as split tests or cohorted content) """
from datetime import datetime
from pytz import UTC
from openedx.core.djangoapps.course_groups.models import CourseUserGroupPartitionGroup
from openedx.core.djangoapps.course_groups.tests.helpers import CohortFactory
from openedx.core.djangoapps.user_api.tests.factories import UserCourseTagFactory
from openedx.core.lib.partitions.partitions import Group, UserPartition
from pytz import UTC
from student.tests.factories import CourseEnrollmentFactory, UserFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.partitions.partitions import UserPartition, Group
from student.tests.factories import CourseEnrollmentFactory, UserFactory
class ContentGroupTestCase(ModuleStoreTestCase):
......
"""
UserPartitionScheme for enrollment tracks.
"""
from course_modes.models import CourseMode
from django.conf import settings
from courseware.masquerade import (
get_course_masquerade,
get_masquerading_user_group,
is_masquerading_as_specific_student
)
from django.conf import settings
from course_modes.models import CourseMode
from student.models import CourseEnrollment
from opaque_keys.edx.keys import CourseKey
from openedx.core.djangoapps.verified_track_content.models import VerifiedTrackCohortedCourse
from openedx.core.lib.partitions.partitions import Group, NoSuchUserPartitionGroupError, UserPartition
from student.models import CourseEnrollment
from xmodule.partitions.partitions import NoSuchUserPartitionGroupError, Group, UserPartition
# These IDs must be less than 100 so that they do not overlap with Groups in
# CohortUserPartition or RandomUserPartitionScheme
......
......@@ -2,17 +2,17 @@
Tests for verified_track_content/partition_scheme.py.
"""
from datetime import datetime, timedelta
import pytz
from ..partition_scheme import EnrollmentTrackPartitionScheme, EnrollmentTrackUserPartition, ENROLLMENT_GROUP_IDS
from ..models import VerifiedTrackCohortedCourse
from course_modes.models import CourseMode
from openedx.core.lib.partitions.partitions import MINIMUM_STATIC_PARTITION_ID, UserPartition
from student.models import CourseEnrollment
from student.tests.factories import UserFactory
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
from ..models import VerifiedTrackCohortedCourse
from ..partition_scheme import ENROLLMENT_GROUP_IDS, EnrollmentTrackPartitionScheme, EnrollmentTrackUserPartition
from xmodule.partitions.partitions import UserPartition, MINIMUM_STATIC_PARTITION_ID
class EnrollmentTrackUserPartitionTest(SharedModuleStoreTestCase):
......
......@@ -16,7 +16,7 @@ from student.tests.factories import UserFactory
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from openedx.core.lib.xblock_fields.inherited_fields import DEFAULT_START_DATE
from xmodule.course_module import DEFAULT_START_DATE
from .test_course_home import course_home_url
......
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