Merge branch 'master' into ri/EDUCATOR-394-disable-self-generation-certificates
This commit is contained in:
@@ -5,9 +5,12 @@ and auto discover tasks in all installed django apps.
|
||||
Taken from: http://celery.readthedocs.org/en/latest/django/first-steps-with-django.html
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
import os
|
||||
|
||||
from celery import Celery
|
||||
from django.conf import settings
|
||||
|
||||
from openedx.core.lib.celery.routers import AlternateEnvironmentRouter
|
||||
|
||||
# set the default Django settings module for the 'celery' program.
|
||||
@@ -34,6 +37,5 @@ class Router(AlternateEnvironmentRouter):
|
||||
return {
|
||||
'openedx.core.djangoapps.content.block_structure.tasks.update_course_in_cache': 'lms',
|
||||
'openedx.core.djangoapps.content.block_structure.tasks.update_course_in_cache_v2': 'lms',
|
||||
'openedx.core.djangoapps.grades.tasks.compute_grades_for_course': 'lms',
|
||||
'openedx.core.djangoapps.grades.tasks.compute_grades_for_course_v2': 'lms',
|
||||
'lms.djangoapps.grades.tasks.compute_all_grades_for_course': 'lms',
|
||||
}
|
||||
|
||||
@@ -4,13 +4,14 @@ Receivers of signals sent from django-user-tasks
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
|
||||
import logging
|
||||
from six.moves.urllib.parse import urljoin # pylint: disable=import-error
|
||||
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.dispatch import receiver
|
||||
from user_tasks.models import UserTaskArtifact
|
||||
from user_tasks.signals import user_task_stopped
|
||||
|
||||
from six.moves.urllib.parse import urljoin # pylint: disable=import-error
|
||||
|
||||
from .tasks import send_task_complete_email
|
||||
|
||||
LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@@ -2,11 +2,10 @@
|
||||
Celery tasks used by cms_user_tasks
|
||||
"""
|
||||
|
||||
from celery.task import task
|
||||
from celery.exceptions import MaxRetriesExceededError
|
||||
from celery.utils.log import get_task_logger
|
||||
from boto.exception import NoAuthHandlerFound
|
||||
|
||||
from celery.exceptions import MaxRetriesExceededError
|
||||
from celery.task import task
|
||||
from celery.utils.log import get_task_logger
|
||||
from django.conf import settings
|
||||
from django.core import mail
|
||||
|
||||
|
||||
@@ -4,21 +4,20 @@ Unit tests for integration of the django-user-tasks app and its REST API.
|
||||
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
|
||||
from uuid import uuid4
|
||||
import logging
|
||||
from uuid import uuid4
|
||||
|
||||
import mock
|
||||
from boto.exception import NoAuthHandlerFound
|
||||
from rest_framework.test import APITestCase
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.models import User
|
||||
from django.core import mail
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.test import override_settings
|
||||
from django.conf import settings
|
||||
from django.core import mail
|
||||
|
||||
from rest_framework.test import APITestCase
|
||||
from user_tasks.models import UserTaskArtifact, UserTaskStatus
|
||||
from user_tasks.serializers import ArtifactSerializer, StatusSerializer
|
||||
|
||||
from .signals import user_task_stopped
|
||||
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
Admin site bindings for contentstore
|
||||
"""
|
||||
|
||||
from config_models.admin import ConfigurationModelAdmin
|
||||
from django.contrib import admin
|
||||
|
||||
from config_models.admin import ConfigurationModelAdmin
|
||||
from contentstore.models import VideoUploadConfig, PushNotificationConfig
|
||||
from contentstore.models import PushNotificationConfig, VideoUploadConfig
|
||||
|
||||
admin.site.register(VideoUploadConfig, ConfigurationModelAdmin)
|
||||
admin.site.register(PushNotificationConfig, ConfigurationModelAdmin)
|
||||
|
||||
@@ -9,7 +9,7 @@ from django.apps import AppConfig
|
||||
|
||||
class ContentstoreConfig(AppConfig):
|
||||
"""
|
||||
Application Configuration for Grades.
|
||||
Application Configuration for Contentstore.
|
||||
"""
|
||||
name = u'contentstore'
|
||||
|
||||
|
||||
@@ -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 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 MINIMUM_STATIC_PARTITION_ID, UserPartition
|
||||
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
|
||||
|
||||
@@ -12,18 +12,17 @@ Current db representation:
|
||||
}
|
||||
"""
|
||||
|
||||
import re
|
||||
import logging
|
||||
import re
|
||||
|
||||
from django.http import HttpResponseBadRequest
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
from xmodule.modulestore.exceptions import ItemNotFoundError
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.html_module import CourseInfoModule
|
||||
|
||||
from openedx.core.lib.xblock_utils import get_course_update_items
|
||||
from cms.djangoapps.contentstore.push_notification import enqueue_push_course_update
|
||||
from openedx.core.lib.xblock_utils import get_course_update_items
|
||||
from xmodule.html_module import CourseInfoModule
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.modulestore.exceptions import ItemNotFoundError
|
||||
|
||||
# # This should be in a class which inherits from XmlDescriptor
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@@ -1,23 +1,25 @@
|
||||
""" Code to allow module store to interface with courseware index """
|
||||
from __future__ import absolute_import
|
||||
from abc import ABCMeta, abstractmethod
|
||||
from datetime import timedelta
|
||||
|
||||
import logging
|
||||
import re
|
||||
from six import add_metaclass
|
||||
from abc import ABCMeta, abstractmethod
|
||||
from datetime import timedelta
|
||||
|
||||
from django.conf import settings
|
||||
from django.utils.translation import ugettext_lazy, ugettext as _
|
||||
from django.core.urlresolvers import resolve
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.utils.translation import ugettext_lazy
|
||||
from search.search_engine_base import SearchEngine
|
||||
from six import add_metaclass
|
||||
|
||||
from contentstore.course_group_config import GroupConfiguration
|
||||
from course_modes.models import CourseMode
|
||||
from eventtracking import tracker
|
||||
from openedx.core.lib.courses import course_image_url
|
||||
from search.search_engine_base import SearchEngine
|
||||
from xmodule.annotator_mixin import html_to_text
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.library_tools import normalize_key_for_search
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
|
||||
# REINDEX_AGE is the default amount of time that we look back for changes
|
||||
# that might have happened. If we are provided with a time at which the
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from django.core.files.uploadhandler import FileUploadHandler
|
||||
import time
|
||||
|
||||
from django.core.files.uploadhandler import FileUploadHandler
|
||||
|
||||
|
||||
class DebugFileUploader(FileUploadHandler):
|
||||
def __init__(self, request=None):
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
# pylint: disable=missing-docstring
|
||||
# pylint: disable=redefined-outer-name
|
||||
|
||||
from lettuce import world, step
|
||||
from nose.tools import assert_false, assert_equal, assert_regexp_matches
|
||||
from common import type_in_codemirror, press_the_notification_button, get_codemirror_value
|
||||
from lettuce import step, world
|
||||
from nose.tools import assert_equal, assert_false, assert_regexp_matches
|
||||
|
||||
from common import get_codemirror_value, press_the_notification_button, type_in_codemirror
|
||||
|
||||
KEY_CSS = '.key h3.title'
|
||||
DISPLAY_NAME_KEY = "Course Display Name"
|
||||
|
||||
@@ -2,21 +2,21 @@
|
||||
# pylint: disable=redefined-outer-name
|
||||
|
||||
import os
|
||||
from lettuce import world, step
|
||||
from nose.tools import assert_true, assert_in
|
||||
from logging import getLogger
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
from student.roles import CourseStaffRole, CourseInstructorRole, GlobalStaff
|
||||
from student.models import get_user
|
||||
|
||||
from lettuce import step, world
|
||||
from nose.tools import assert_in, assert_true
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
|
||||
from logging import getLogger
|
||||
from student.tests.factories import AdminFactory
|
||||
from student import auth
|
||||
from student.models import get_user
|
||||
from student.roles import CourseInstructorRole, CourseStaffRole, GlobalStaff
|
||||
from student.tests.factories import AdminFactory
|
||||
from terrain.browser import reset_data
|
||||
|
||||
logger = getLogger(__name__)
|
||||
|
||||
from terrain.browser import reset_data
|
||||
|
||||
TEST_ROOT = settings.COMMON_TEST_DATA_ROOT
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
# argument name "step" instead of "_step" and pylint does not like that.
|
||||
# pylint: disable=unused-argument
|
||||
|
||||
from lettuce import world, step
|
||||
from nose.tools import assert_true, assert_in, assert_equal
|
||||
from lettuce import step, world
|
||||
from nose.tools import assert_equal, assert_in, assert_true
|
||||
|
||||
DISPLAY_NAME = "Display Name"
|
||||
|
||||
|
||||
@@ -3,10 +3,11 @@
|
||||
|
||||
from lettuce import world
|
||||
from nose.tools import assert_equal, assert_in
|
||||
from terrain.steps import reload_the_page
|
||||
from common import type_in_codemirror
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
|
||||
from common import type_in_codemirror
|
||||
from terrain.steps import reload_the_page
|
||||
|
||||
|
||||
@world.absorb
|
||||
def create_component_instance(step, category, component_type=None, is_advanced=False, advanced_component=None):
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
# pylint: disable=missing-docstring
|
||||
# pylint: disable=redefined-outer-name
|
||||
|
||||
from lettuce import world, step
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
from cms.djangoapps.contentstore.features.common import type_in_codemirror
|
||||
from django.conf import settings
|
||||
from lettuce import step, world
|
||||
from nose.tools import assert_false, assert_true
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
|
||||
from nose.tools import assert_true, assert_false
|
||||
from cms.djangoapps.contentstore.features.common import type_in_codemirror
|
||||
|
||||
TEST_ROOT = settings.COMMON_TEST_DATA_ROOT
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
# pylint: disable=missing-docstring
|
||||
|
||||
from cms.djangoapps.contentstore.features.common import type_in_codemirror, get_codemirror_value
|
||||
from lettuce import world, step
|
||||
from lettuce import step, world
|
||||
from nose.tools import assert_in
|
||||
|
||||
from cms.djangoapps.contentstore.features.common import get_codemirror_value, type_in_codemirror
|
||||
|
||||
|
||||
@step(u'I go to the course updates page')
|
||||
def go_to_updates(_step):
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
# pylint: disable=unused-argument
|
||||
|
||||
import os
|
||||
from lettuce import world, step
|
||||
|
||||
from django.conf import settings
|
||||
from lettuce import step, world
|
||||
|
||||
|
||||
def import_file(filename):
|
||||
|
||||
@@ -2,9 +2,11 @@
|
||||
# pylint: disable=redefined-outer-name
|
||||
# pylint: disable=unused-argument
|
||||
|
||||
from lettuce import world, step
|
||||
from lettuce import step, world
|
||||
|
||||
from common import *
|
||||
|
||||
|
||||
############### ACTIONS ####################
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# disable missing docstring
|
||||
# pylint: disable=missing-docstring
|
||||
|
||||
from lettuce import world, step
|
||||
from lettuce import step, world
|
||||
|
||||
|
||||
@step('I have created a Discussion Tag$')
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
# pylint: disable=missing-docstring
|
||||
# pylint: disable=redefined-outer-name
|
||||
|
||||
from lettuce import world, step
|
||||
from common import *
|
||||
from terrain.steps import reload_the_page
|
||||
from lettuce import step, world
|
||||
from nose.tools import assert_equal, assert_in, assert_not_equal
|
||||
from selenium.common.exceptions import InvalidElementStateException
|
||||
|
||||
from common import *
|
||||
from contentstore.utils import reverse_course_url
|
||||
from nose.tools import assert_in, assert_equal, assert_not_equal
|
||||
from terrain.steps import reload_the_page
|
||||
|
||||
|
||||
@step(u'I am viewing the grading settings')
|
||||
|
||||
@@ -3,9 +3,10 @@
|
||||
|
||||
from collections import OrderedDict
|
||||
|
||||
from lettuce import world, step
|
||||
from nose.tools import assert_in, assert_false, assert_true, assert_equal
|
||||
from common import type_in_codemirror, get_codemirror_value
|
||||
from lettuce import step, world
|
||||
from nose.tools import assert_equal, assert_false, assert_in, assert_true
|
||||
|
||||
from common import get_codemirror_value, type_in_codemirror
|
||||
|
||||
CODEMIRROR_SELECTOR_PREFIX = "$('iframe').contents().find"
|
||||
|
||||
|
||||
@@ -2,10 +2,9 @@
|
||||
# pylint: disable=redefined-outer-name
|
||||
# pylint: disable=unused-argument
|
||||
|
||||
from lettuce import world, step
|
||||
from lettuce import step, world
|
||||
from nose.tools import assert_equal, assert_in
|
||||
|
||||
|
||||
CSS_FOR_TAB_ELEMENT = "li[data-tab-id='{0}'] input.toggle-checkbox"
|
||||
|
||||
|
||||
|
||||
@@ -2,10 +2,12 @@
|
||||
# pylint: disable=missing-docstring
|
||||
|
||||
import json
|
||||
from lettuce import world, step
|
||||
|
||||
from lettuce import step, world
|
||||
from nose.tools import assert_equal, assert_true
|
||||
from common import type_in_codemirror, open_new_course
|
||||
from advanced_settings import change_value, ADVANCED_MODULES_KEY
|
||||
|
||||
from advanced_settings import ADVANCED_MODULES_KEY, change_value
|
||||
from common import open_new_course, type_in_codemirror
|
||||
from course_import import import_file
|
||||
|
||||
DISPLAY_NAME = "Display Name"
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# pylint: disable=missing-docstring
|
||||
# pylint: disable=redefined-outer-name
|
||||
|
||||
from lettuce import world, step
|
||||
from nose.tools import assert_true, assert_false
|
||||
from lettuce import step, world
|
||||
from nose.tools import assert_false, assert_true
|
||||
|
||||
|
||||
@step('I fill in the registration form$')
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
# pylint: disable=missing-docstring
|
||||
|
||||
from lettuce import world, step
|
||||
from django.conf import settings
|
||||
from common import upload_file
|
||||
from lettuce import step, world
|
||||
from nose.tools import assert_equal
|
||||
|
||||
from common import upload_file
|
||||
|
||||
TEST_ROOT = settings.COMMON_TEST_DATA_ROOT
|
||||
|
||||
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
# pylint: disable=missing-docstring
|
||||
|
||||
import os
|
||||
from lettuce import world, step
|
||||
|
||||
from django.conf import settings
|
||||
from lettuce import step, world
|
||||
from splinter.request_handler.request_handler import RequestHandler
|
||||
|
||||
from xmodule.contentstore.content import StaticContent
|
||||
from xmodule.contentstore.django import contentstore
|
||||
from xmodule.exceptions import NotFoundError
|
||||
from splinter.request_handler.request_handler import RequestHandler
|
||||
|
||||
TEST_ROOT = settings.COMMON_TEST_DATA_ROOT
|
||||
|
||||
|
||||
@@ -1,17 +1,19 @@
|
||||
# pylint: disable=missing-docstring
|
||||
# pylint: disable=redefined-outer-name
|
||||
|
||||
from lettuce import world, step
|
||||
from lettuce.django import django_url
|
||||
from django.conf import settings
|
||||
import requests
|
||||
import string
|
||||
import random
|
||||
import os
|
||||
import random
|
||||
import string
|
||||
|
||||
import requests
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.models import User
|
||||
from student.models import CourseEnrollment
|
||||
from lettuce import step, world
|
||||
from lettuce.django import django_url
|
||||
from nose.tools import assert_equal, assert_not_equal
|
||||
|
||||
from student.models import CourseEnrollment
|
||||
|
||||
TEST_ROOT = settings.COMMON_TEST_DATA_ROOT
|
||||
ASSET_NAMES_CSS = 'td.name-col > span.title > a.filename'
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# pylint: disable=missing-docstring
|
||||
|
||||
from lettuce import world, step
|
||||
from lettuce import step, world
|
||||
|
||||
SELECTORS = {
|
||||
'spinner': '.video-wrapper .spinner',
|
||||
|
||||
@@ -7,8 +7,8 @@ from collections import namedtuple
|
||||
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.django import modulestore
|
||||
|
||||
Result = namedtuple("Result", ["course_key", "cert_name_short", "cert_name_long", "should_clean"])
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@ or with filename which starts with "._") for all courses
|
||||
import logging
|
||||
|
||||
from django.core.management.base import BaseCommand
|
||||
from xmodule.contentstore.django import contentstore
|
||||
|
||||
from xmodule.contentstore.django import contentstore
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -2,12 +2,13 @@
|
||||
Script for cloning a course
|
||||
"""
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from student.roles import CourseInstructorRole, CourseStaffRole
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
from opaque_keys import InvalidKeyError
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
from opaque_keys.edx.locations import SlashSeparatedCourseKey
|
||||
|
||||
from student.roles import CourseInstructorRole, CourseStaffRole
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.django import modulestore
|
||||
|
||||
|
||||
#
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
"""
|
||||
Django management command to create a course in a specific modulestore
|
||||
"""
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from django.contrib.auth.models import User
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from contentstore.views.course import create_new_course_in_store
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
|
||||
from contentstore.management.commands.utils import user_from_str
|
||||
from contentstore.views.course import create_new_course_in_store
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
|
||||
@@ -8,13 +8,15 @@
|
||||
none
|
||||
"""
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from .prompt import query_yes_no
|
||||
from contentstore.utils import delete_course_and_groups
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
from opaque_keys import InvalidKeyError
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
|
||||
from contentstore.utils import delete_course_and_groups
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.django import modulestore
|
||||
|
||||
from .prompt import query_yes_no
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
"""
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
"""Script for deleting orphans"""
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from contentstore.views.item import _delete_orphans
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
from opaque_keys import InvalidKeyError
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
|
||||
from contentstore.views.item import _delete_orphans
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
|
||||
|
||||
|
||||
@@ -8,14 +8,14 @@
|
||||
#
|
||||
from optparse import make_option
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from .prompt import query_yes_no
|
||||
|
||||
from courseware.courses import get_course_by_id
|
||||
from opaque_keys import InvalidKeyError
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
from opaque_keys.edx.locations import SlashSeparatedCourseKey
|
||||
|
||||
from contentstore.views import tabs
|
||||
from opaque_keys import InvalidKeyError
|
||||
from opaque_keys.edx.locations import SlashSeparatedCourseKey
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
from courseware.courses import get_course_by_id
|
||||
|
||||
from .prompt import query_yes_no
|
||||
|
||||
|
||||
def print_course(course):
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from opaque_keys import InvalidKeyError
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
from opaque_keys.edx.locations import SlashSeparatedCourseKey
|
||||
|
||||
from xmodule.contentstore.utils import empty_asset_trashcan
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
|
||||
from .prompt import query_yes_no
|
||||
from opaque_keys import InvalidKeyError
|
||||
from opaque_keys.edx.locations import SlashSeparatedCourseKey
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
|
||||
@@ -4,13 +4,14 @@ Script for exporting courseware from Mongo to a tar.gz file
|
||||
import os
|
||||
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from xmodule.modulestore.xml_exporter import export_course_to_xml
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
from xmodule.contentstore.django import contentstore
|
||||
from opaque_keys import InvalidKeyError
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
from opaque_keys.edx.locations import SlashSeparatedCourseKey
|
||||
|
||||
from xmodule.contentstore.django import contentstore
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.modulestore.xml_exporter import export_course_to_xml
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
"""
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
Script for exporting all courseware from Mongo to a directory and listing the courses which failed to export
|
||||
"""
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from xmodule.modulestore.xml_exporter import export_course_to_xml
|
||||
from xmodule.modulestore.django import modulestore
|
||||
|
||||
from xmodule.contentstore.django import contentstore
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.modulestore.xml_exporter import export_course_to_xml
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
|
||||
@@ -19,17 +19,16 @@ import os
|
||||
import re
|
||||
import shutil
|
||||
import tarfile
|
||||
from tempfile import mktemp, mkdtemp
|
||||
from tempfile import mkdtemp, mktemp
|
||||
from textwrap import dedent
|
||||
|
||||
from path import Path as path
|
||||
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from opaque_keys import InvalidKeyError
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
from path import Path as path
|
||||
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.modulestore.xml_exporter import export_course_to_xml
|
||||
from opaque_keys import InvalidKeyError
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
|
||||
@@ -3,8 +3,10 @@ Script for fixing the item not found errors in a course
|
||||
"""
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
from xmodule.modulestore.django import modulestore
|
||||
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.django import modulestore
|
||||
|
||||
|
||||
# To run from command line: ./manage.py cms fix_not_found course-v1:org+course+run
|
||||
|
||||
|
||||
@@ -2,13 +2,16 @@
|
||||
Script for force publishing a course
|
||||
"""
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from opaque_keys import InvalidKeyError
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.django import modulestore
|
||||
|
||||
from .prompt import query_yes_no
|
||||
from .utils import get_course_versions
|
||||
|
||||
|
||||
# To run from command line: ./manage.py cms force_publish course-v1:org+course+run
|
||||
|
||||
|
||||
|
||||
@@ -18,12 +18,12 @@ from optparse import make_option
|
||||
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from django.utils.translation import ugettext as _
|
||||
from opaque_keys import InvalidKeyError
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
from opaque_keys.edx.locations import SlashSeparatedCourseKey
|
||||
|
||||
import contentstore.git_export_utils as git_export_utils
|
||||
from opaque_keys.edx.locations import SlashSeparatedCourseKey
|
||||
from opaque_keys import InvalidKeyError
|
||||
from contentstore.git_export_utils import GitExportError
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -4,12 +4,12 @@ Script for importing courseware from XML format
|
||||
from optparse import make_option
|
||||
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from django_comment_common.utils import (seed_permissions_roles,
|
||||
are_permissions_roles_seeded)
|
||||
from xmodule.modulestore.xml_importer import import_course_from_xml
|
||||
|
||||
from django_comment_common.utils import are_permissions_roles_seeded, seed_permissions_roles
|
||||
from xmodule.contentstore.django import contentstore
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.contentstore.django import contentstore
|
||||
from xmodule.modulestore.xml_importer import import_course_from_xml
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
|
||||
@@ -2,14 +2,15 @@
|
||||
Django management command to migrate a course from the old Mongo modulestore
|
||||
to the new split-Mongo modulestore.
|
||||
"""
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from django.contrib.auth.models import User
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from opaque_keys import InvalidKeyError
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
|
||||
from contentstore.management.commands.utils import user_from_str
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.modulestore.split_migrator import SplitMigrator
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
from opaque_keys import InvalidKeyError
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from contentstore.management.commands.utils import user_from_str
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
|
||||
@@ -3,13 +3,14 @@ Script for granting existing course instructors course creator privileges.
|
||||
|
||||
This script is only intended to be run once on a given environment.
|
||||
"""
|
||||
from course_creators.views import add_user_with_status_granted, add_user_with_status_unrequested
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.db.utils import IntegrityError
|
||||
|
||||
from course_creators.views import add_user_with_status_granted, add_user_with_status_unrequested
|
||||
from student.roles import CourseInstructorRole, CourseStaffRole
|
||||
|
||||
|
||||
#------------ to run: ./manage.py cms populate_creators --settings=dev
|
||||
|
||||
|
||||
|
||||
@@ -1,21 +1,20 @@
|
||||
""" Management command to update courses' search index """
|
||||
import logging
|
||||
from django.core.management import BaseCommand, CommandError
|
||||
from optparse import make_option
|
||||
from textwrap import dedent
|
||||
|
||||
from contentstore.courseware_index import CoursewareSearchIndexer
|
||||
from search.search_engine_base import SearchEngine
|
||||
from django.core.management import BaseCommand, CommandError
|
||||
from elasticsearch import exceptions
|
||||
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
from opaque_keys import InvalidKeyError
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
from opaque_keys.edx.locator import CourseLocator
|
||||
from search.search_engine_base import SearchEngine
|
||||
|
||||
from contentstore.courseware_index import CoursewareSearchIndexer
|
||||
from xmodule.modulestore.django import modulestore
|
||||
|
||||
from .prompt import query_yes_no
|
||||
|
||||
from xmodule.modulestore.django import modulestore
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
"""
|
||||
|
||||
@@ -1,19 +1,18 @@
|
||||
""" Management command to update libraries' search index """
|
||||
from django.core.management import BaseCommand, CommandError
|
||||
from optparse import make_option
|
||||
from textwrap import dedent
|
||||
|
||||
from contentstore.courseware_index import LibrarySearchIndexer
|
||||
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
from django.core.management import BaseCommand, CommandError
|
||||
from opaque_keys import InvalidKeyError
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
from opaque_keys.edx.locations import SlashSeparatedCourseKey
|
||||
from opaque_keys.edx.locator import LibraryLocator
|
||||
|
||||
from .prompt import query_yes_no
|
||||
|
||||
from contentstore.courseware_index import LibrarySearchIndexer
|
||||
from xmodule.modulestore.django import modulestore
|
||||
|
||||
from .prompt import query_yes_no
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
"""
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
|
||||
from xmodule.contentstore.utils import restore_asset_from_trashcan
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ Common methods for cms commands to use
|
||||
"""
|
||||
from django.contrib.auth.models import User
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
|
||||
from xmodule.modulestore.django import modulestore
|
||||
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
Verify the structure of courseware as to it's suitability for import
|
||||
"""
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
|
||||
from xmodule.modulestore.xml_importer import perform_xlint
|
||||
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
@@ -2,9 +2,8 @@
|
||||
Models for contentstore
|
||||
"""
|
||||
|
||||
from django.db.models.fields import TextField
|
||||
|
||||
from config_models.models import ConfigurationModel
|
||||
from django.db.models.fields import TextField
|
||||
|
||||
|
||||
class VideoUploadConfig(ConfigurationModel):
|
||||
|
||||
@@ -5,24 +5,20 @@ Code related to the handling of Proctored Exams in Studio
|
||||
import logging
|
||||
|
||||
from django.conf import settings
|
||||
from edx_proctoring.api import (
|
||||
create_exam,
|
||||
create_exam_review_policy,
|
||||
get_all_exams_for_course,
|
||||
get_exam_by_content_id,
|
||||
remove_review_policy,
|
||||
update_exam,
|
||||
update_review_policy
|
||||
)
|
||||
from edx_proctoring.exceptions import ProctoredExamNotFoundException, ProctoredExamReviewPolicyNotFoundException
|
||||
|
||||
from contentstore.views.helpers import is_item_in_course_tree
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.modulestore.exceptions import ItemNotFoundError
|
||||
from contentstore.views.helpers import is_item_in_course_tree
|
||||
|
||||
from edx_proctoring.api import (
|
||||
get_exam_by_content_id,
|
||||
update_exam,
|
||||
create_exam,
|
||||
get_all_exams_for_course,
|
||||
update_review_policy,
|
||||
create_exam_review_policy,
|
||||
remove_review_policy,
|
||||
)
|
||||
from edx_proctoring.exceptions import (
|
||||
ProctoredExamNotFoundException,
|
||||
ProctoredExamReviewPolicyNotFoundException
|
||||
)
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -2,16 +2,17 @@
|
||||
Helper methods for push notifications from Studio.
|
||||
"""
|
||||
|
||||
from uuid import uuid4
|
||||
from django.conf import settings
|
||||
from logging import exception as log_exception
|
||||
from uuid import uuid4
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
from contentstore.tasks import push_course_update_task
|
||||
from contentstore.models import PushNotificationConfig
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from parse_rest.installation import Push
|
||||
from contentstore.tasks import push_course_update_task
|
||||
from parse_rest.connection import register
|
||||
from parse_rest.core import ParseError
|
||||
from parse_rest.installation import Push
|
||||
from xmodule.modulestore.django import modulestore
|
||||
|
||||
|
||||
def push_notification_enabled():
|
||||
|
||||
@@ -2,16 +2,18 @@
|
||||
|
||||
import logging
|
||||
from datetime import datetime
|
||||
from pytz import UTC
|
||||
|
||||
from django.dispatch import receiver
|
||||
from pytz import UTC
|
||||
|
||||
from xmodule.modulestore.django import modulestore, SignalHandler
|
||||
from contentstore.courseware_index import CoursewareSearchIndexer, LibrarySearchIndexer
|
||||
from contentstore.proctoring import register_special_exams
|
||||
from lms.djangoapps.grades.tasks import compute_all_grades_for_course
|
||||
from openedx.core.djangoapps.credit.signals import on_course_publish
|
||||
from openedx.core.lib.gating import api as gating_api
|
||||
from util.module_utils import yield_dynamic_descriptor_descendants
|
||||
from .signals import GRADING_POLICY_CHANGED
|
||||
from xmodule.modulestore.django import SignalHandler, modulestore
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
@@ -84,3 +86,18 @@ def handle_item_deleted(**kwargs):
|
||||
gating_api.remove_prerequisite(module.location)
|
||||
# Remove any 'requires' course content milestone relationships
|
||||
gating_api.set_required_content(course_key, module.location, None, None)
|
||||
|
||||
|
||||
@receiver(GRADING_POLICY_CHANGED)
|
||||
def handle_grading_policy_changed(sender, **kwargs):
|
||||
# pylint: disable=unused-argument
|
||||
"""
|
||||
Receives signal and kicks off celery task to recalculate grades
|
||||
"""
|
||||
course_key = kwargs.get('course_key')
|
||||
result = compute_all_grades_for_course.apply_async(course_key=course_key)
|
||||
log.info("Grades: Created {task_name}[{task_id}] with arguments {kwargs}".format(
|
||||
task_name=compute_all_grades_for_course.name,
|
||||
task_id=result.task_id,
|
||||
kwargs=kwargs,
|
||||
))
|
||||
|
||||
@@ -5,7 +5,6 @@ from __future__ import absolute_import
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.files.storage import get_storage_class
|
||||
|
||||
from storages.backends.s3boto import S3BotoStorage
|
||||
from storages.utils import setting
|
||||
|
||||
|
||||
@@ -13,11 +13,6 @@ from tempfile import NamedTemporaryFile, mkdtemp
|
||||
|
||||
from celery.task import task
|
||||
from celery.utils.log import get_task_logger
|
||||
from organizations.models import OrganizationCourse
|
||||
from path import Path as path
|
||||
from pytz import UTC
|
||||
from six import iteritems, text_type
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.models import User
|
||||
from django.core.exceptions import SuspiciousOperation
|
||||
@@ -25,8 +20,13 @@ from django.core.files import File
|
||||
from django.test import RequestFactory
|
||||
from django.utils.text import get_valid_filename
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
from djcelery.common import respect_language
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
from opaque_keys.edx.locator import LibraryLocator
|
||||
from organizations.models import OrganizationCourse
|
||||
from path import Path as path
|
||||
from pytz import UTC
|
||||
from six import iteritems, text_type
|
||||
from user_tasks.models import UserTaskArtifact, UserTaskStatus
|
||||
from user_tasks.tasks import UserTask
|
||||
|
||||
@@ -36,9 +36,7 @@ from contentstore.storage import course_import_export_storage
|
||||
from contentstore.utils import initialize_permissions, reverse_usage_url
|
||||
from course_action_state.models import CourseRerunState
|
||||
from models.settings.course_metadata import CourseMetadata
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
from opaque_keys.edx.locator import LibraryLocator
|
||||
from openedx.core.djangoapps.embargo.models import RestrictedCourse, CountryAccessRule
|
||||
from openedx.core.djangoapps.embargo.models import CountryAccessRule, RestrictedCourse
|
||||
from openedx.core.lib.extract_tar import safetar_extractall
|
||||
from student.auth import has_course_author_access
|
||||
from xmodule.contentstore.django import contentstore
|
||||
@@ -50,7 +48,6 @@ from xmodule.modulestore.exceptions import DuplicateCourseError, ItemNotFoundErr
|
||||
from xmodule.modulestore.xml_exporter import export_course_to_xml, export_library_to_xml
|
||||
from xmodule.modulestore.xml_importer import import_course_from_xml, import_library_from_xml
|
||||
|
||||
|
||||
LOGGER = get_task_logger(__name__)
|
||||
FILE_READ_CHUNK = 1024 # bytes
|
||||
FULL_COURSE_REINDEX_THRESHOLD = 1
|
||||
|
||||
@@ -2,21 +2,21 @@
|
||||
Unit tests for cloning a course between the same and different module stores.
|
||||
"""
|
||||
import json
|
||||
from django.conf import settings
|
||||
|
||||
from django.conf import settings
|
||||
from mock import Mock, patch
|
||||
from opaque_keys.edx.locator import CourseLocator
|
||||
from xmodule.modulestore import ModuleStoreEnum, EdxJSONEncoder
|
||||
from contentstore.tests.utils import CourseTestCase
|
||||
|
||||
from contentstore.tasks import rerun_course
|
||||
from student.auth import has_course_author_access
|
||||
from course_action_state.models import CourseRerunState
|
||||
from contentstore.tests.utils import CourseTestCase
|
||||
from course_action_state.managers import CourseRerunUIStateManager
|
||||
from mock import patch, Mock
|
||||
from course_action_state.models import CourseRerunState
|
||||
from student.auth import has_course_author_access
|
||||
from xmodule.contentstore.content import StaticContent
|
||||
from xmodule.contentstore.django import contentstore
|
||||
from xmodule.modulestore import EdxJSONEncoder, ModuleStoreEnum
|
||||
from xmodule.modulestore.tests.factories import CourseFactory
|
||||
|
||||
|
||||
TEST_DATA_DIR = settings.COMMON_TEST_DATA_ROOT
|
||||
|
||||
|
||||
|
||||
@@ -1,63 +1,54 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import copy
|
||||
import mock
|
||||
import shutil
|
||||
import lxml.html
|
||||
from lxml import etree
|
||||
import ddt
|
||||
|
||||
from datetime import timedelta
|
||||
from fs.osfs import OSFS
|
||||
from json import loads
|
||||
from path import Path as path
|
||||
from textwrap import dedent
|
||||
from uuid import uuid4
|
||||
from functools import wraps
|
||||
from json import loads
|
||||
from textwrap import dedent
|
||||
from unittest import SkipTest
|
||||
from uuid import uuid4
|
||||
|
||||
import ddt
|
||||
import lxml.html
|
||||
import mock
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.models import User
|
||||
from django.test import TestCase
|
||||
from django.test.utils import override_settings
|
||||
|
||||
from openedx.core.lib.tempdir import mkdtemp_clean
|
||||
from common.test.utils import XssTestMixin
|
||||
from contentstore.tests.utils import parse_json, AjaxEnabledTestClient, CourseTestCase
|
||||
from contentstore.views.component import ADVANCED_COMPONENT_TYPES
|
||||
|
||||
from edxval.api import create_video, get_videos_for_course
|
||||
|
||||
from xmodule.contentstore.django import contentstore
|
||||
from xmodule.contentstore.utils import restore_asset_from_trashcan, empty_asset_trashcan
|
||||
from xmodule.exceptions import InvalidVersionError
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.exceptions import ItemNotFoundError
|
||||
from xmodule.modulestore.inheritance import own_metadata
|
||||
from opaque_keys.edx.keys import UsageKey, CourseKey
|
||||
from fs.osfs import OSFS
|
||||
from lxml import etree
|
||||
from opaque_keys import InvalidKeyError
|
||||
from opaque_keys.edx.keys import CourseKey, UsageKey
|
||||
from opaque_keys.edx.locations import AssetLocation, CourseLocator
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory, LibraryFactory, check_mongo_calls
|
||||
from xmodule.modulestore.xml_exporter import export_course_to_xml
|
||||
from xmodule.modulestore.xml_importer import import_course_from_xml, perform_xlint
|
||||
from path import Path as path
|
||||
|
||||
from xmodule.capa_module import CapaDescriptor
|
||||
from xmodule.course_module import CourseDescriptor, Textbook
|
||||
from xmodule.seq_module import SequenceDescriptor
|
||||
|
||||
from contentstore.utils import delete_course_and_groups, reverse_url, reverse_course_url
|
||||
from common.test.utils import XssTestMixin
|
||||
from contentstore.tests.utils import AjaxEnabledTestClient, CourseTestCase, get_url, parse_json
|
||||
from contentstore.utils import delete_course_and_groups, reverse_course_url, reverse_url
|
||||
from contentstore.views.component import ADVANCED_COMPONENT_TYPES
|
||||
from course_action_state.managers import CourseActionStateItemNotFoundError
|
||||
from course_action_state.models import CourseRerunState, CourseRerunUIStateManager
|
||||
from django_comment_common.utils import are_permissions_roles_seeded
|
||||
|
||||
from openedx.core.lib.tempdir import mkdtemp_clean
|
||||
from student import auth
|
||||
from student.models import CourseEnrollment
|
||||
from student.roles import CourseCreatorRole, CourseInstructorRole
|
||||
from opaque_keys import InvalidKeyError
|
||||
from contentstore.tests.utils import get_url
|
||||
from course_action_state.models import CourseRerunState, CourseRerunUIStateManager
|
||||
|
||||
from course_action_state.managers import CourseActionStateItemNotFoundError
|
||||
from xmodule.capa_module import CapaDescriptor
|
||||
from xmodule.contentstore.content import StaticContent
|
||||
from xmodule.contentstore.django import contentstore
|
||||
from xmodule.contentstore.utils import empty_asset_trashcan, restore_asset_from_trashcan
|
||||
from xmodule.course_module import CourseDescriptor, Textbook
|
||||
from xmodule.exceptions import InvalidVersionError
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.django import modulestore
|
||||
|
||||
from xmodule.modulestore.exceptions import ItemNotFoundError
|
||||
from xmodule.modulestore.inheritance import own_metadata
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory, LibraryFactory, check_mongo_calls
|
||||
from xmodule.modulestore.xml_exporter import export_course_to_xml
|
||||
from xmodule.modulestore.xml_importer import import_course_from_xml, perform_xlint
|
||||
from xmodule.seq_module import SequenceDescriptor
|
||||
|
||||
TEST_DATA_CONTENTSTORE = copy.deepcopy(settings.CONTENTSTORE)
|
||||
TEST_DATA_CONTENTSTORE['DOC_STORE_CONFIG']['db'] = 'test_xcontent_%s' % uuid4().hex
|
||||
|
||||
@@ -3,9 +3,9 @@ Tests core caching facilities.
|
||||
"""
|
||||
|
||||
from django.test import TestCase
|
||||
|
||||
from opaque_keys.edx.locations import Location
|
||||
from openedx.core.djangoapps.contentserver.caching import get_cached_content, set_cached_content, del_cached_content
|
||||
|
||||
from openedx.core.djangoapps.contentserver.caching import del_cached_content, get_cached_content, set_cached_content
|
||||
|
||||
|
||||
class Content(object):
|
||||
|
||||
@@ -1,26 +1,23 @@
|
||||
"""
|
||||
Test view handler for rerun (and eventually create)
|
||||
"""
|
||||
import ddt
|
||||
from mock import patch
|
||||
from datetime import datetime
|
||||
|
||||
from django.test.client import RequestFactory
|
||||
import ddt
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.test.client import RequestFactory
|
||||
from mock import patch
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import CourseFactory
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from contentstore.tests.utils import AjaxEnabledTestClient, parse_json
|
||||
from student.roles import CourseInstructorRole, CourseStaffRole
|
||||
from student.tests.factories import UserFactory
|
||||
from contentstore.tests.utils import AjaxEnabledTestClient, parse_json
|
||||
from datetime import datetime
|
||||
from util.organizations_helpers import add_organization, get_course_organizations
|
||||
from xmodule.course_module import CourseFields
|
||||
from util.organizations_helpers import (
|
||||
add_organization,
|
||||
get_course_organizations,
|
||||
)
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import CourseFactory
|
||||
|
||||
|
||||
@ddt.ddt
|
||||
|
||||
@@ -4,43 +4,40 @@ by reversing group name formats.
|
||||
"""
|
||||
import random
|
||||
|
||||
from chrono import Timer
|
||||
from mock import patch, Mock
|
||||
import ddt
|
||||
|
||||
from django.conf import settings
|
||||
from ccx_keys.locator import CCXLocator
|
||||
from chrono import Timer
|
||||
from django.conf import settings
|
||||
from django.test import RequestFactory
|
||||
from django.test.client import Client
|
||||
from mock import Mock, patch
|
||||
from opaque_keys.edx.locations import CourseLocator
|
||||
|
||||
from common.test.utils import XssTestMixin
|
||||
from xmodule.course_module import CourseSummary
|
||||
|
||||
from contentstore.tests.utils import AjaxEnabledTestClient
|
||||
from contentstore.utils import delete_course_and_groups
|
||||
from contentstore.views.course import (
|
||||
AccessListFallback,
|
||||
_accessible_courses_iter,
|
||||
_accessible_courses_list_from_groups,
|
||||
AccessListFallback,
|
||||
get_courses_accessible_to_user,
|
||||
_accessible_courses_summary_iter,
|
||||
get_courses_accessible_to_user
|
||||
)
|
||||
from contentstore.utils import delete_course_and_groups
|
||||
from contentstore.tests.utils import AjaxEnabledTestClient
|
||||
from student.tests.factories import UserFactory
|
||||
from course_action_state.models import CourseRerunState
|
||||
from student.roles import (
|
||||
CourseInstructorRole,
|
||||
CourseStaffRole,
|
||||
GlobalStaff,
|
||||
OrgStaffRole,
|
||||
OrgInstructorRole,
|
||||
UserBasedRole,
|
||||
OrgStaffRole,
|
||||
UserBasedRole
|
||||
)
|
||||
from student.tests.factories import UserFactory
|
||||
from xmodule.course_module import CourseSummary
|
||||
from xmodule.error_module import ErrorDescriptor
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, check_mongo_calls
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from opaque_keys.edx.locations import CourseLocator
|
||||
from xmodule.error_module import ErrorDescriptor
|
||||
from course_action_state.models import CourseRerunState
|
||||
|
||||
|
||||
TOTAL_COURSES_COUNT = 10
|
||||
USER_COURSES_COUNT = 1
|
||||
|
||||
@@ -8,21 +8,22 @@ 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 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 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
|
||||
|
||||
@@ -8,6 +8,13 @@ from unittest import skip
|
||||
from uuid import uuid4
|
||||
|
||||
import ddt
|
||||
from dateutil.tz import tzutc
|
||||
from django.conf import settings
|
||||
from lazy.lazy import lazy
|
||||
from mock import patch
|
||||
from pytz import UTC
|
||||
from search.search_engine_base import SearchEngine
|
||||
|
||||
from contentstore.courseware_index import (
|
||||
CourseAboutSearchIndexer,
|
||||
CoursewareSearchIndexer,
|
||||
@@ -18,19 +25,12 @@ from contentstore.signals.handlers import listen_for_course_publish, listen_for_
|
||||
from contentstore.tests.utils import CourseTestCase
|
||||
from contentstore.utils import reverse_course_url, reverse_usage_url
|
||||
from course_modes.models import CourseMode
|
||||
from dateutil.tz import tzutc
|
||||
from django.conf import settings
|
||||
from lazy.lazy import lazy
|
||||
from mock import patch
|
||||
from openedx.core.djangoapps.models.course_details import CourseDetails
|
||||
from openedx.core.lib.partitions.partitions import UserPartition
|
||||
from openedx.core.lib.xblock_fields.inherited_fields import InheritanceMixin
|
||||
from pytz import UTC
|
||||
from search.search_engine_base import SearchEngine
|
||||
from xmodule.library_tools import normalize_key_for_search
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.django import SignalHandler, modulestore
|
||||
from xmodule.modulestore.edit_info import EditInfoMixin
|
||||
from xmodule.modulestore.inheritance import InheritanceMixin
|
||||
from xmodule.modulestore.mixed import MixedModuleStore
|
||||
from xmodule.modulestore.tests.django_utils import (
|
||||
TEST_DATA_MONGO_MODULESTORE,
|
||||
@@ -45,6 +45,7 @@ from xmodule.modulestore.tests.utils import (
|
||||
MongoContentstoreBuilder,
|
||||
create_modulestore_instance
|
||||
)
|
||||
from xmodule.partitions.partitions import UserPartition
|
||||
from xmodule.tests import DATA_DIR
|
||||
from xmodule.x_module import XModuleMixin
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
from xmodule import templates
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase, TEST_DATA_SPLIT_MODULESTORE
|
||||
from xmodule.course_module import CourseDescriptor
|
||||
from xmodule.seq_module import SequenceDescriptor
|
||||
from xmodule.capa_module import CapaDescriptor
|
||||
from xmodule.course_module import CourseDescriptor
|
||||
from xmodule.html_module import HtmlDescriptor
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.exceptions import DuplicateCourseError
|
||||
from xmodule.modulestore.tests.django_utils import TEST_DATA_SPLIT_MODULESTORE, ModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
|
||||
from xmodule.seq_module import SequenceDescriptor
|
||||
|
||||
|
||||
class TemplateTests(ModuleStoreTestCase):
|
||||
|
||||
@@ -11,10 +11,11 @@ from uuid import uuid4
|
||||
from django.conf import settings
|
||||
from django.test.utils import override_settings
|
||||
|
||||
from .utils import CourseTestCase
|
||||
import contentstore.git_export_utils as git_export_utils
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from contentstore.utils import reverse_course_url
|
||||
from xmodule.modulestore.django import modulestore
|
||||
|
||||
from .utils import CourseTestCase
|
||||
|
||||
TEST_DATA_CONTENTSTORE = copy.deepcopy(settings.CONTENTSTORE)
|
||||
TEST_DATA_CONTENTSTORE['DOC_STORE_CONFIG']['db'] = 'test_xcontent_%s' % uuid4().hex
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
"""
|
||||
Unit tests for the gating feature in Studio
|
||||
"""
|
||||
from contentstore.signals.handlers import handle_item_deleted
|
||||
from milestones.tests.utils import MilestonesTestCaseMixin
|
||||
from mock import patch
|
||||
|
||||
from contentstore.signals.handlers import handle_item_deleted
|
||||
from openedx.core.lib.gating import api as gating_api
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import ItemFactory, CourseFactory
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
|
||||
|
||||
|
||||
class TestHandleItemDeleted(ModuleStoreTestCase, MilestonesTestCaseMixin):
|
||||
|
||||
@@ -1,17 +1,19 @@
|
||||
"""
|
||||
Tests for validate Internationalization and Module i18n service.
|
||||
"""
|
||||
import mock
|
||||
import gettext
|
||||
from unittest import skip
|
||||
|
||||
import mock
|
||||
from django.contrib.auth.models import User
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
from contentstore.tests.utils import AjaxEnabledTestClient
|
||||
from xmodule.modulestore.django import ModuleI18nService
|
||||
from django.utils import translation
|
||||
from django.utils.translation import get_language
|
||||
from xmodule.modulestore.tests.factories import ItemFactory, CourseFactory
|
||||
|
||||
from contentstore.tests.utils import AjaxEnabledTestClient
|
||||
from contentstore.views.preview import _preview_module_system
|
||||
from xmodule.modulestore.django import ModuleI18nService
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
|
||||
|
||||
|
||||
class FakeTranslations(ModuleI18nService):
|
||||
|
||||
@@ -4,22 +4,23 @@
|
||||
Tests for import_course_from_xml using the mongo modulestore.
|
||||
"""
|
||||
|
||||
import copy
|
||||
from uuid import uuid4
|
||||
|
||||
import ddt
|
||||
from django.conf import settings
|
||||
from django.test.client import Client
|
||||
from django.test.utils import override_settings
|
||||
from django.conf import settings
|
||||
import ddt
|
||||
import copy
|
||||
from mock import patch
|
||||
|
||||
from openedx.core.djangoapps.content.course_structures.tests import SignalDisconnectTestMixin
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
from xmodule.contentstore.django import contentstore
|
||||
from xmodule.exceptions import NotFoundError
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.contentstore.django import contentstore
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import check_exact_number_of_calls, check_number_of_calls
|
||||
from xmodule.modulestore.xml_importer import import_course_from_xml
|
||||
from xmodule.exceptions import NotFoundError
|
||||
from uuid import uuid4
|
||||
|
||||
TEST_DATA_CONTENTSTORE = copy.deepcopy(settings.CONTENTSTORE)
|
||||
TEST_DATA_CONTENTSTORE['DOC_STORE_CONFIG']['db'] = 'test_xcontent_%s' % uuid4().hex
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
"""
|
||||
Tests Draft import order.
|
||||
"""
|
||||
from xmodule.modulestore.xml_importer import import_course_from_xml
|
||||
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from django.conf import settings
|
||||
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
from xmodule.modulestore.xml_importer import import_course_from_xml
|
||||
|
||||
TEST_DATA_DIR = settings.COMMON_TEST_DATA_ROOT
|
||||
|
||||
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
Integration tests for importing courses containing pure XBlocks.
|
||||
"""
|
||||
|
||||
from django.conf import settings
|
||||
from xblock.core import XBlock
|
||||
from xblock.fields import String
|
||||
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.xml_importer import import_course_from_xml
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.modulestore.mongo.draft import as_draft
|
||||
from django.conf import settings
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
from xmodule.modulestore.xml_importer import import_course_from_xml
|
||||
|
||||
TEST_DATA_DIR = settings.COMMON_TEST_DATA_ROOT
|
||||
|
||||
|
||||
@@ -1,31 +1,35 @@
|
||||
"""
|
||||
Content library unit tests that require the CMS runtime.
|
||||
"""
|
||||
import ddt
|
||||
from django.test.utils import override_settings
|
||||
from mock import Mock, patch
|
||||
from opaque_keys.edx.locator import CourseKey, LibraryLocator
|
||||
|
||||
from contentstore.tests.utils import AjaxEnabledTestClient, parse_json
|
||||
from contentstore.utils import reverse_url, reverse_usage_url, reverse_library_url
|
||||
from contentstore.utils import reverse_library_url, reverse_url, reverse_usage_url
|
||||
from contentstore.views.item import _duplicate_item
|
||||
from contentstore.views.preview import _load_preview_module
|
||||
from contentstore.views.tests.test_library import LIBRARY_REST_URL
|
||||
import ddt
|
||||
from mock import patch
|
||||
from course_creators.views import add_user_with_status_granted
|
||||
from openedx.core.djangoapps.content.course_structures.tests import SignalDisconnectTestMixin
|
||||
from student import auth
|
||||
from student.auth import has_studio_read_access, has_studio_write_access
|
||||
from student.roles import (
|
||||
CourseInstructorRole, CourseStaffRole, LibraryUserRole,
|
||||
OrgStaffRole, OrgInstructorRole, OrgLibraryUserRole,
|
||||
CourseInstructorRole,
|
||||
CourseStaffRole,
|
||||
LibraryUserRole,
|
||||
OrgInstructorRole,
|
||||
OrgLibraryUserRole,
|
||||
OrgStaffRole
|
||||
)
|
||||
from student.tests.factories import UserFactory
|
||||
from xblock_django.user_service import DjangoXBlockUserService
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
|
||||
from mock import Mock
|
||||
from opaque_keys.edx.locator import CourseKey, LibraryLocator
|
||||
from openedx.core.djangoapps.content.course_structures.tests import SignalDisconnectTestMixin
|
||||
from xblock_django.user_service import DjangoXBlockUserService
|
||||
from xmodule.x_module import STUDIO_VIEW
|
||||
from student import auth
|
||||
from student.tests.factories import UserFactory
|
||||
from course_creators.views import add_user_with_status_granted
|
||||
|
||||
|
||||
class LibraryTestCase(ModuleStoreTestCase):
|
||||
|
||||
@@ -2,11 +2,12 @@
|
||||
Test finding orphans via the view and django config
|
||||
"""
|
||||
import json
|
||||
|
||||
import ddt
|
||||
from opaque_keys.edx.locator import BlockUsageLocator
|
||||
|
||||
from contentstore.tests.utils import CourseTestCase
|
||||
from contentstore.utils import reverse_course_url
|
||||
from opaque_keys.edx.locator import BlockUsageLocator
|
||||
from student.models import CourseEnrollment
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.search import path_to_location
|
||||
|
||||
@@ -5,11 +5,11 @@ import copy
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
from contentstore.tests.utils import AjaxEnabledTestClient
|
||||
from contentstore.utils import reverse_url, reverse_course_url
|
||||
from student.roles import CourseInstructorRole, CourseStaffRole, OrgStaffRole, OrgInstructorRole
|
||||
from contentstore.utils import reverse_course_url, reverse_url
|
||||
from student import auth
|
||||
from student.roles import CourseInstructorRole, CourseStaffRole, OrgInstructorRole, OrgStaffRole
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
|
||||
|
||||
class TestCourseAccess(ModuleStoreTestCase):
|
||||
|
||||
@@ -2,19 +2,16 @@
|
||||
Tests for the edx_proctoring integration into Studio
|
||||
"""
|
||||
|
||||
from mock import patch
|
||||
import ddt
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
import ddt
|
||||
from edx_proctoring.api import get_all_exams_for_course, get_review_policy_by_exam_id
|
||||
from mock import patch
|
||||
from pytz import UTC
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
|
||||
|
||||
from contentstore.signals.handlers import listen_for_course_publish
|
||||
|
||||
from edx_proctoring.api import (
|
||||
get_all_exams_for_course,
|
||||
get_review_policy_by_exam_id
|
||||
)
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
|
||||
|
||||
|
||||
@ddt.ddt
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
"""Tests for CMS's requests to logs"""
|
||||
import mock
|
||||
|
||||
from django.test import TestCase
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.test import TestCase
|
||||
|
||||
from contentstore.views.helpers import event as cms_user_track
|
||||
|
||||
|
||||
|
||||
@@ -15,13 +15,13 @@ from opaque_keys.edx.locator import CourseLocator
|
||||
from organizations.models import OrganizationCourse
|
||||
from organizations.tests.factories import OrganizationFactory
|
||||
from user_tasks.models import UserTaskArtifact, UserTaskStatus
|
||||
from xmodule.modulestore.django import modulestore
|
||||
|
||||
from contentstore.tasks import export_olx, rerun_course
|
||||
from contentstore.tests.test_libraries import LibraryTestCase
|
||||
from contentstore.tests.utils import CourseTestCase
|
||||
from course_action_state.models import CourseRerunState
|
||||
from openedx.core.djangoapps.embargo.models import RestrictedCourse, CountryAccessRule, Country
|
||||
from openedx.core.djangoapps.embargo.models import Country, CountryAccessRule, RestrictedCourse
|
||||
from xmodule.modulestore.django import modulestore
|
||||
|
||||
TEST_DATA_CONTENTSTORE = copy.deepcopy(settings.CONTENTSTORE)
|
||||
TEST_DATA_CONTENTSTORE['DOC_STORE_CONFIG']['db'] = 'test_xcontent_%s' % uuid4().hex
|
||||
|
||||
@@ -1,24 +1,23 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
""" Tests for transcripts_utils. """
|
||||
import unittest
|
||||
from uuid import uuid4
|
||||
import copy
|
||||
import textwrap
|
||||
from mock import patch, Mock
|
||||
import unittest
|
||||
from uuid import uuid4
|
||||
|
||||
from django.test.utils import override_settings
|
||||
from django.conf import settings
|
||||
from django.test.utils import override_settings
|
||||
from django.utils import translation
|
||||
|
||||
from mock import Mock, patch
|
||||
from nose.plugins.skip import SkipTest
|
||||
|
||||
from xmodule.modulestore.tests.factories import CourseFactory
|
||||
from xmodule.contentstore.content import StaticContent
|
||||
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
|
||||
from xmodule.exceptions import NotFoundError
|
||||
from xmodule.contentstore.django import contentstore
|
||||
from xmodule.video_module import transcripts_utils
|
||||
from contentstore.tests.utils import mock_requests_get
|
||||
from xmodule.contentstore.content import StaticContent
|
||||
from xmodule.contentstore.django import contentstore
|
||||
from xmodule.exceptions import NotFoundError
|
||||
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import CourseFactory
|
||||
from xmodule.video_module import transcripts_utils
|
||||
|
||||
TEST_DATA_CONTENTSTORE = copy.deepcopy(settings.CONTENTSTORE)
|
||||
TEST_DATA_CONTENTSTORE['DOC_STORE_CONFIG']['db'] = 'test_xcontent_%s' % uuid4().hex
|
||||
|
||||
@@ -5,9 +5,8 @@ after deleting it creates same course again
|
||||
from contentstore.tests.utils import AjaxEnabledTestClient
|
||||
from contentstore.utils import delete_course_and_groups, reverse_url
|
||||
from courseware.tests.factories import UserFactory
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
|
||||
from student.models import CourseEnrollment
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
|
||||
|
||||
class TestUsersDefaultRole(ModuleStoreTestCase):
|
||||
|
||||
@@ -2,17 +2,18 @@
|
||||
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 contentstore import utils
|
||||
from contentstore.tests.utils import CourseTestCase
|
||||
from openedx.core.djangoapps.site_configuration.tests.test_util import with_site_configuration_context
|
||||
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.partitions.partitions import Group, UserPartition
|
||||
|
||||
|
||||
class LMSLinksTestCase(TestCase):
|
||||
|
||||
@@ -1,27 +1,26 @@
|
||||
"""
|
||||
This test file will test registration, login, activation, and session activity timeouts
|
||||
"""
|
||||
import datetime
|
||||
import time
|
||||
import mock
|
||||
import unittest
|
||||
from ddt import ddt, data, unpack
|
||||
|
||||
from django.test import TestCase
|
||||
from django.test.utils import override_settings
|
||||
from django.core.cache import cache
|
||||
import mock
|
||||
from ddt import data, ddt, unpack
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.models import User
|
||||
from django.core.cache import cache
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.test import TestCase
|
||||
from django.test.utils import override_settings
|
||||
from freezegun import freeze_time
|
||||
from pytz import UTC
|
||||
|
||||
from contentstore.models import PushNotificationConfig
|
||||
from contentstore.tests.test_course_settings import CourseTestCase
|
||||
from contentstore.tests.utils import parse_json, user, registration, AjaxEnabledTestClient
|
||||
from contentstore.tests.utils import AjaxEnabledTestClient, parse_json, registration, user
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import CourseFactory
|
||||
import datetime
|
||||
from pytz import UTC
|
||||
|
||||
from freezegun import freeze_time
|
||||
|
||||
|
||||
class ContentStoreTestCase(ModuleStoreTestCase):
|
||||
|
||||
@@ -3,23 +3,23 @@ Utilities for contentstore tests
|
||||
'''
|
||||
import json
|
||||
import textwrap
|
||||
from mock import Mock
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.models import User
|
||||
from django.test.client import Client
|
||||
from opaque_keys.edx.locations import SlashSeparatedCourseKey, AssetLocation
|
||||
from mock import Mock
|
||||
from opaque_keys.edx.locations import AssetLocation, SlashSeparatedCourseKey
|
||||
|
||||
from contentstore.utils import reverse_url
|
||||
from student.models import Registration
|
||||
from xmodule.modulestore.split_mongo.split import SplitMongoModuleStore
|
||||
from xmodule.contentstore.django import contentstore
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.inheritance import own_metadata
|
||||
from xmodule.modulestore.split_mongo.split import SplitMongoModuleStore
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import CourseFactory
|
||||
from xmodule.modulestore.xml_importer import import_course_from_xml
|
||||
from xmodule.modulestore.tests.utils import ProceduralCourseTestMixin
|
||||
from xmodule.modulestore.xml_importer import import_course_from_xml
|
||||
|
||||
TEST_DATA_DIR = settings.COMMON_TEST_DATA_ROOT
|
||||
|
||||
|
||||
@@ -8,19 +8,20 @@ from datetime import datetime
|
||||
from django.conf import settings
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.utils.translation import ugettext as _
|
||||
from opaque_keys.edx.keys import CourseKey, UsageKey
|
||||
from pytz import UTC
|
||||
|
||||
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.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.modulestore.exceptions import ItemNotFoundError
|
||||
from xmodule.partitions.partitions_service import get_all_partitions_for_course
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
""" Helper methods for determining user access permissions in Studio """
|
||||
|
||||
from student.roles import CourseInstructorRole
|
||||
from student import auth
|
||||
from student.roles import CourseInstructorRole
|
||||
|
||||
|
||||
def get_user_role(user, course_id):
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import logging
|
||||
from functools import partial
|
||||
import math
|
||||
import json
|
||||
from pymongo import ASCENDING, DESCENDING
|
||||
import logging
|
||||
import math
|
||||
from functools import partial
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.decorators import login_required
|
||||
@@ -11,11 +10,12 @@ from django.http import HttpResponseBadRequest, HttpResponseNotFound
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.views.decorators.csrf import ensure_csrf_cookie
|
||||
from django.views.decorators.http import require_http_methods, require_POST
|
||||
from opaque_keys.edx.keys import AssetKey, CourseKey
|
||||
from pymongo import ASCENDING, DESCENDING
|
||||
|
||||
from edxmako.shortcuts import render_to_response
|
||||
from contentstore.utils import reverse_course_url
|
||||
from contentstore.views.exception import AssetNotFoundException
|
||||
from opaque_keys.edx.keys import CourseKey, AssetKey
|
||||
from edxmako.shortcuts import render_to_response
|
||||
from openedx.core.djangoapps.contentserver.caching import del_cached_content
|
||||
from student.auth import has_course_author_access
|
||||
from util.date_utils import get_default_time_display
|
||||
|
||||
@@ -26,27 +26,26 @@ import logging
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.views.decorators.csrf import ensure_csrf_cookie
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.http import HttpResponse
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.views.decorators.csrf import ensure_csrf_cookie
|
||||
from django.views.decorators.http import require_http_methods
|
||||
|
||||
from contentstore.utils import reverse_course_url
|
||||
from edxmako.shortcuts import render_to_response
|
||||
from opaque_keys.edx.keys import CourseKey, AssetKey
|
||||
from opaque_keys import InvalidKeyError
|
||||
from opaque_keys.edx.keys import AssetKey, CourseKey
|
||||
|
||||
from contentstore.utils import get_lms_link_for_certificate_web_view, reverse_course_url
|
||||
from contentstore.views.assets import delete_asset
|
||||
from contentstore.views.exception import AssetNotFoundException
|
||||
from course_modes.models import CourseMode
|
||||
from edxmako.shortcuts import render_to_response
|
||||
from eventtracking import tracker
|
||||
from student.auth import has_studio_write_access
|
||||
from student.roles import GlobalStaff
|
||||
from util.db import generate_int_id, MYSQL_MAX_INT
|
||||
from util.db import MYSQL_MAX_INT, generate_int_id
|
||||
from util.json_request import JsonResponse
|
||||
from xmodule.modulestore import EdxJSONEncoder
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from contentstore.views.assets import delete_asset
|
||||
from contentstore.views.exception import AssetNotFoundException
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from course_modes.models import CourseMode
|
||||
from contentstore.utils import get_lms_link_for_certificate_web_view
|
||||
|
||||
CERTIFICATE_SCHEMA_VERSION = 1
|
||||
CERTIFICATE_MINIMUM_ID = 100
|
||||
|
||||
@@ -2,36 +2,30 @@ from __future__ import absolute_import
|
||||
|
||||
import logging
|
||||
|
||||
from django.http import HttpResponseBadRequest, Http404
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.views.decorators.http import require_GET
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.http import Http404, HttpResponseBadRequest
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.views.decorators.http import require_GET
|
||||
from opaque_keys import InvalidKeyError
|
||||
from opaque_keys.edx.asides import AsideUsageKeyV1, AsideUsageKeyV2
|
||||
from xmodule.modulestore.exceptions import ItemNotFoundError
|
||||
from edxmako.shortcuts import render_to_response
|
||||
|
||||
from xmodule.modulestore.django import modulestore
|
||||
|
||||
from opaque_keys.edx.keys import UsageKey
|
||||
from xblock.core import XBlock
|
||||
from xblock.django.request import webob_to_django_response, django_to_webob_request
|
||||
from xblock.django.request import django_to_webob_request, webob_to_django_response
|
||||
from xblock.exceptions import NoSuchHandlerError
|
||||
from xblock.plugin import PluginMissingError
|
||||
from xblock.runtime import Mixologist
|
||||
|
||||
from contentstore.utils import get_lms_link_for_item, reverse_course_url, get_xblock_aside_instance
|
||||
from contentstore.utils import get_lms_link_for_item, get_xblock_aside_instance, reverse_course_url
|
||||
from contentstore.views.helpers import get_parent_xblock, is_unit, xblock_type_display_name
|
||||
from contentstore.views.item import create_xblock_info, add_container_page_publishing_info, StudioEditModuleRuntime
|
||||
|
||||
from opaque_keys.edx.keys import UsageKey
|
||||
|
||||
from contentstore.views.item import StudioEditModuleRuntime, add_container_page_publishing_info, create_xblock_info
|
||||
from edxmako.shortcuts import render_to_response
|
||||
from student.auth import has_course_author_access
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
from xblock_django.api import disabled_xblocks, authorable_xblocks
|
||||
from xblock_django.api import authorable_xblocks, disabled_xblocks
|
||||
from xblock_django.models import XBlockStudioConfigurationFlag
|
||||
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.modulestore.exceptions import ItemNotFoundError
|
||||
|
||||
__all__ = [
|
||||
'container_handler',
|
||||
|
||||
@@ -7,76 +7,63 @@ import logging
|
||||
import random
|
||||
import string # pylint: disable=deprecated-module
|
||||
|
||||
import django.utils
|
||||
import six
|
||||
from ccx_keys.locator import CCXLocator
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.http import HttpResponse, HttpResponseBadRequest, HttpResponseNotFound, Http404
|
||||
from django.http import Http404, HttpResponse, HttpResponseBadRequest, HttpResponseNotFound
|
||||
from django.shortcuts import redirect
|
||||
import django.utils
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.views.decorators.http import require_http_methods, require_GET
|
||||
from django.views.decorators.csrf import ensure_csrf_cookie
|
||||
import six
|
||||
|
||||
from django.views.decorators.http import require_GET, require_http_methods
|
||||
from opaque_keys import InvalidKeyError
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
from opaque_keys.edx.locations import Location
|
||||
|
||||
from .component import (
|
||||
ADVANCED_COMPONENT_TYPES,
|
||||
)
|
||||
from .item import create_xblock_info
|
||||
from .library import LIBRARIES_ENABLED, get_library_creator_status
|
||||
from ccx_keys.locator import CCXLocator
|
||||
from contentstore.course_group_config import (
|
||||
COHORT_SCHEME,
|
||||
ENROLLMENT_SCHEME,
|
||||
GroupConfiguration,
|
||||
GroupConfigurationsValidationError,
|
||||
RANDOM_SCHEME,
|
||||
GroupConfiguration,
|
||||
GroupConfigurationsValidationError
|
||||
)
|
||||
from contentstore.course_info_model import get_course_updates, update_course_updates, delete_course_update
|
||||
from contentstore.course_info_model import delete_course_update, get_course_updates, update_course_updates
|
||||
from contentstore.courseware_index import CoursewareSearchIndexer, SearchIndexingError
|
||||
from contentstore.push_notification import push_notification_enabled
|
||||
from contentstore.tasks import rerun_course
|
||||
from contentstore.utils import (
|
||||
add_instructor,
|
||||
initialize_permissions,
|
||||
get_lms_link_for_item,
|
||||
initialize_permissions,
|
||||
remove_all_instructors,
|
||||
reverse_course_url,
|
||||
reverse_library_url,
|
||||
reverse_usage_url,
|
||||
reverse_url,
|
||||
reverse_usage_url
|
||||
)
|
||||
from contentstore.views.entrance_exam import (
|
||||
create_entrance_exam,
|
||||
delete_entrance_exam,
|
||||
update_entrance_exam,
|
||||
)
|
||||
from contentstore.views.entrance_exam import create_entrance_exam, delete_entrance_exam, update_entrance_exam
|
||||
from course_action_state.managers import CourseActionStateItemNotFoundError
|
||||
from course_action_state.models import CourseRerunState, CourseRerunUIStateManager
|
||||
from course_creators.views import get_course_creator_status, add_user_with_status_unrequested
|
||||
from course_creators.views import add_user_with_status_unrequested, get_course_creator_status
|
||||
from edxmako.shortcuts import render_to_response
|
||||
from models.settings.course_grading import CourseGradingModel
|
||||
from models.settings.course_metadata import CourseMetadata
|
||||
from models.settings.encoder import CourseSettingsEncoder
|
||||
from openedx.core.djangoapps.content.course_structures.api.v0 import api, errors
|
||||
from openedx.core.djangoapps.credit.api import is_credit_course, get_credit_requirements
|
||||
from openedx.core.djangoapps.credit.api import get_credit_requirements, is_credit_course
|
||||
from openedx.core.djangoapps.credit.tasks import update_credit_course_requirements
|
||||
from openedx.core.djangoapps.models.course_details import CourseDetails
|
||||
from openedx.core.djangoapps.self_paced.models import SelfPacedConfiguration
|
||||
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
|
||||
from openedx.core.djangolib.js_utils import dump_js_escaped_json
|
||||
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
|
||||
from student.roles import (
|
||||
CourseInstructorRole, CourseStaffRole, CourseCreatorRole, GlobalStaff, UserBasedRole
|
||||
)
|
||||
from student.auth import has_course_author_access, has_studio_read_access, has_studio_write_access
|
||||
from student.roles import CourseCreatorRole, CourseInstructorRole, CourseStaffRole, GlobalStaff, UserBasedRole
|
||||
from util.course import get_link_for_about_page
|
||||
from util.date_utils import get_default_time_display
|
||||
from util.json_request import JsonResponse, JsonResponseBadRequest, expect_json
|
||||
@@ -84,23 +71,23 @@ from util.milestones_helpers import (
|
||||
is_entrance_exams_enabled,
|
||||
is_prerequisite_courses_enabled,
|
||||
is_valid_course_key,
|
||||
set_prerequisite_courses,
|
||||
)
|
||||
from util.organizations_helpers import (
|
||||
add_organization_course,
|
||||
get_organization_by_short_name,
|
||||
organizations_enabled,
|
||||
set_prerequisite_courses
|
||||
)
|
||||
from util.organizations_helpers import add_organization_course, get_organization_by_short_name, organizations_enabled
|
||||
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, CourseFields
|
||||
from xmodule.error_module import ErrorDescriptor
|
||||
from xmodule.modulestore import EdxJSONEncoder
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.modulestore.exceptions import ItemNotFoundError, DuplicateCourseError
|
||||
from xmodule.modulestore.exceptions import DuplicateCourseError, ItemNotFoundError
|
||||
from xmodule.tabs import CourseTab, CourseTabList, InvalidTabsException
|
||||
|
||||
from .component import ADVANCED_COMPONENT_TYPES
|
||||
from .item import create_xblock_info
|
||||
from .library import LIBRARIES_ENABLED, get_library_creator_status
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
__all__ = ['course_info_handler', 'course_handler', 'course_listing',
|
||||
|
||||
@@ -2,25 +2,25 @@
|
||||
Entrance Exams view module -- handles all requests related to entrance exam management via Studio
|
||||
Intended to be utilized as an AJAX callback handler, versus a proper view/screen
|
||||
"""
|
||||
from functools import wraps
|
||||
import logging
|
||||
from functools import wraps
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.views.decorators.csrf import ensure_csrf_cookie
|
||||
from django.http import HttpResponse, HttpResponseBadRequest
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.views.decorators.csrf import ensure_csrf_cookie
|
||||
from opaque_keys import InvalidKeyError
|
||||
from opaque_keys.edx.keys import CourseKey, UsageKey
|
||||
|
||||
from openedx.core.djangolib.js_utils import dump_js_escaped_json
|
||||
from contentstore.views.helpers import create_xblock, remove_entrance_exam_graders
|
||||
from contentstore.views.item import delete_item
|
||||
from models.settings.course_metadata import CourseMetadata
|
||||
from opaque_keys.edx.keys import CourseKey, UsageKey
|
||||
from opaque_keys import InvalidKeyError
|
||||
from openedx.core.djangolib.js_utils import dump_js_escaped_json
|
||||
from student.auth import has_course_author_access
|
||||
from util import milestones_helpers
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.modulestore.exceptions import ItemNotFoundError
|
||||
from django.conf import settings
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
__all__ = ['entrance_exam', ]
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
# pylint: disable=missing-docstring,unused-argument
|
||||
|
||||
from django.http import (HttpResponse, HttpResponseServerError,
|
||||
HttpResponseNotFound)
|
||||
from edxmako.shortcuts import render_to_string, render_to_response
|
||||
import functools
|
||||
|
||||
from django.http import HttpResponse, HttpResponseNotFound, HttpResponseServerError
|
||||
|
||||
from edxmako.shortcuts import render_to_response, render_to_string
|
||||
from openedx.core.djangolib.js_utils import dump_js_escaped_json
|
||||
|
||||
__all__ = ['not_found', 'server_error', 'render_404', 'render_500']
|
||||
|
||||
@@ -7,14 +7,14 @@ import logging
|
||||
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.views.decorators.csrf import ensure_csrf_cookie
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.views.decorators.csrf import ensure_csrf_cookie
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
|
||||
from student.auth import has_course_author_access
|
||||
import contentstore.git_export_utils as git_export_utils
|
||||
from edxmako.shortcuts import render_to_response
|
||||
from student.auth import has_course_author_access
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -4,24 +4,23 @@ Helper methods for Studio views.
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
from uuid import uuid4
|
||||
import urllib
|
||||
from uuid import uuid4
|
||||
|
||||
from django.conf import settings
|
||||
from django.http import HttpResponse
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
from edxmako.shortcuts import render_to_string
|
||||
from opaque_keys.edx.keys import UsageKey
|
||||
from xblock.core import XBlock
|
||||
import dogstats_wrapper as dog_stats_api
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.x_module import DEPRECATION_VSCOMPAT_EVENT
|
||||
from xmodule.tabs import StaticTab
|
||||
|
||||
import dogstats_wrapper as dog_stats_api
|
||||
from contentstore.utils import reverse_course_url, reverse_library_url, reverse_usage_url
|
||||
from edxmako.shortcuts import render_to_string
|
||||
from models.settings.course_grading import CourseGradingModel
|
||||
from util.milestones_helpers import is_entrance_exams_enabled
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.tabs import StaticTab
|
||||
from xmodule.x_module import DEPRECATION_VSCOMPAT_EVENT
|
||||
|
||||
__all__ = ['event']
|
||||
|
||||
|
||||
@@ -8,9 +8,6 @@ import logging
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
from path import Path as path
|
||||
|
||||
from six import text_type
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.decorators import login_required
|
||||
@@ -18,28 +15,26 @@ from django.core.exceptions import PermissionDenied
|
||||
from django.core.files import File
|
||||
from django.core.servers.basehttp import FileWrapper
|
||||
from django.db import transaction
|
||||
from django.http import HttpResponse, HttpResponseNotFound, Http404
|
||||
from django.http import Http404, HttpResponse, HttpResponseNotFound
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.views.decorators.csrf import ensure_csrf_cookie
|
||||
from django.views.decorators.http import require_http_methods, require_GET
|
||||
|
||||
from edxmako.shortcuts import render_to_response
|
||||
from xmodule.exceptions import SerializationError
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from django.views.decorators.http import require_GET, require_http_methods
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
from opaque_keys.edx.locator import LibraryLocator
|
||||
from path import Path as path
|
||||
from six import text_type
|
||||
from user_tasks.conf import settings as user_tasks_settings
|
||||
from user_tasks.models import UserTaskArtifact, UserTaskStatus
|
||||
|
||||
from student.auth import has_course_author_access
|
||||
|
||||
from util.json_request import JsonResponse
|
||||
from util.views import ensure_valid_course_key
|
||||
from contentstore.storage import course_import_export_storage
|
||||
from contentstore.tasks import CourseExportTask, CourseImportTask, create_export_tarball, export_olx, import_olx
|
||||
|
||||
from contentstore.utils import reverse_course_url, reverse_library_url
|
||||
|
||||
from edxmako.shortcuts import render_to_response
|
||||
from student.auth import has_course_author_access
|
||||
from util.json_request import JsonResponse
|
||||
from util.views import ensure_valid_course_key
|
||||
from xmodule.exceptions import SerializationError
|
||||
from xmodule.modulestore.django import modulestore
|
||||
|
||||
__all__ = [
|
||||
'import_handler', 'import_status_handler',
|
||||
|
||||
@@ -8,55 +8,62 @@ from datetime import datetime
|
||||
from functools import partial
|
||||
from uuid import uuid4
|
||||
|
||||
import dogstats_wrapper as dog_stats_api
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.contrib.auth.models import User
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.http import HttpResponseBadRequest, HttpResponse, Http404
|
||||
from django.http import Http404, HttpResponse, HttpResponseBadRequest
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.views.decorators.http import require_http_methods
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
from opaque_keys.edx.locator import LibraryUsageLocator
|
||||
from pytz import UTC
|
||||
|
||||
from xblock.core import XBlock
|
||||
from xblock.fields import Scope
|
||||
from xblock.fragment import Fragment
|
||||
|
||||
from xblock_config.models import CourseEditLTIFieldsEnabledFlag
|
||||
from xblock_django.user_service import DjangoXBlockUserService
|
||||
|
||||
import dogstats_wrapper as dog_stats_api
|
||||
from cms.lib.xblock.authoring_mixin import VISIBILITY_VIEW
|
||||
from contentstore.utils import (
|
||||
find_release_date_source, find_staff_lock_source, is_currently_visible_to_students,
|
||||
ancestor_has_staff_lock, has_children_visible_to_specific_partition_groups,
|
||||
get_user_partition_info, get_split_group_display_name,
|
||||
ancestor_has_staff_lock,
|
||||
find_release_date_source,
|
||||
find_staff_lock_source,
|
||||
get_split_group_display_name,
|
||||
get_user_partition_info,
|
||||
has_children_visible_to_specific_partition_groups,
|
||||
is_currently_visible_to_students,
|
||||
is_self_paced
|
||||
)
|
||||
from contentstore.views.helpers import (
|
||||
create_xblock,
|
||||
get_parent_xblock,
|
||||
is_unit,
|
||||
usage_key_with_run,
|
||||
xblock_primary_child_category,
|
||||
xblock_studio_url,
|
||||
xblock_type_display_name
|
||||
)
|
||||
from contentstore.views.helpers import is_unit, xblock_studio_url, xblock_primary_child_category, \
|
||||
xblock_type_display_name, get_parent_xblock, create_xblock, usage_key_with_run
|
||||
from contentstore.views.preview import get_preview_fragment
|
||||
from contentstore.utils import is_self_paced
|
||||
|
||||
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 openedx.core.lib.xblock_utils import request_token, wrap_xblock
|
||||
from static_replace import replace_static_urls
|
||||
from student.auth import has_studio_write_access, has_studio_read_access
|
||||
from student.auth import has_studio_read_access, has_studio_write_access
|
||||
from util.date_utils import get_default_time_display
|
||||
from util.json_request import expect_json, JsonResponse
|
||||
from util.json_request import JsonResponse, expect_json
|
||||
from util.milestones_helpers import is_entrance_exams_enabled
|
||||
from xmodule.modulestore import ModuleStoreEnum, EdxJSONEncoder
|
||||
from xblock_config.models import CourseEditLTIFieldsEnabledFlag
|
||||
from xblock_django.user_service import DjangoXBlockUserService
|
||||
from xmodule.course_module import DEFAULT_START_DATE
|
||||
from xmodule.modulestore import EdxJSONEncoder, ModuleStoreEnum
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.modulestore.draft_and_published import DIRECT_ONLY_CATEGORIES
|
||||
from xmodule.modulestore.exceptions import ItemNotFoundError, InvalidLocationError
|
||||
from xmodule.modulestore.exceptions import InvalidLocationError, ItemNotFoundError
|
||||
from xmodule.modulestore.inheritance import own_metadata
|
||||
from xmodule.services import ConfigurationService, SettingsService
|
||||
from xmodule.tabs import CourseTabList
|
||||
from xmodule.x_module import PREVIEW_VIEWS, STUDIO_VIEW, STUDENT_VIEW, DEPRECATION_VSCOMPAT_EVENT
|
||||
|
||||
from xmodule.x_module import DEPRECATION_VSCOMPAT_EVENT, PREVIEW_VIEWS, STUDENT_VIEW, STUDIO_VIEW
|
||||
|
||||
__all__ = [
|
||||
'orphan_handler', 'xblock_handler', 'xblock_view_handler', 'xblock_outline_handler', 'xblock_container_handler'
|
||||
|
||||
@@ -7,31 +7,36 @@ from __future__ import absolute_import
|
||||
|
||||
import logging
|
||||
|
||||
from contentstore.views.item import create_xblock_info
|
||||
from contentstore.utils import reverse_library_url, add_instructor
|
||||
from django.http import HttpResponseNotAllowed, Http404, HttpResponseForbidden
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.conf import settings
|
||||
from django.http import Http404, HttpResponseForbidden, HttpResponseNotAllowed
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.views.decorators.http import require_http_methods
|
||||
from django.views.decorators.csrf import ensure_csrf_cookie
|
||||
from edxmako.shortcuts import render_to_response
|
||||
from django.views.decorators.http import require_http_methods
|
||||
from opaque_keys import InvalidKeyError
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
from opaque_keys.edx.locator import LibraryLocator, LibraryUsageLocator
|
||||
from xmodule.modulestore.exceptions import DuplicateCourseError
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from .user import user_with_role
|
||||
|
||||
from contentstore.utils import add_instructor, reverse_library_url
|
||||
from contentstore.views.item import create_xblock_info
|
||||
from course_creators.views import get_course_creator_status
|
||||
from .component import get_component_templates, CONTAINER_TEMPLATES
|
||||
from edxmako.shortcuts import render_to_response
|
||||
from student.auth import (
|
||||
STUDIO_VIEW_USERS, STUDIO_EDIT_ROLES, get_user_permissions, has_studio_read_access, has_studio_write_access
|
||||
STUDIO_EDIT_ROLES,
|
||||
STUDIO_VIEW_USERS,
|
||||
get_user_permissions,
|
||||
has_studio_read_access,
|
||||
has_studio_write_access
|
||||
)
|
||||
from student.roles import CourseInstructorRole, CourseStaffRole, LibraryUserRole
|
||||
from util.json_request import expect_json, JsonResponse, JsonResponseBadRequest
|
||||
from util.json_request import JsonResponse, JsonResponseBadRequest, expect_json
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.modulestore.exceptions import DuplicateCourseError
|
||||
|
||||
from .component import CONTAINER_TEMPLATES, get_component_templates
|
||||
from .user import user_with_role
|
||||
|
||||
__all__ = ['library_handler', 'manage_library_users']
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
"""Organizations views for use with Studio."""
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.http import HttpResponse
|
||||
from django.utils.decorators import method_decorator
|
||||
from django.views.generic import View
|
||||
from django.http import HttpResponse
|
||||
|
||||
from openedx.core.djangolib.js_utils import dump_js_escaped_json
|
||||
from util.organizations_helpers import get_organizations
|
||||
|
||||
@@ -3,20 +3,24 @@ 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.utils.translation import ugettext as _
|
||||
from opaque_keys.edx.keys import UsageKey
|
||||
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
|
||||
|
||||
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 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,
|
||||
@@ -26,16 +30,13 @@ from openedx.core.lib.xblock_utils import (
|
||||
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.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.partitions.partitions_service import PartitionService
|
||||
from xmodule.services import SettingsService
|
||||
from xmodule.studio_editable import has_author_view
|
||||
from xmodule.x_module import AUTHOR_VIEW, PREVIEW_VIEWS, STUDENT_VIEW, ModuleSystem
|
||||
@@ -280,7 +281,7 @@ def _studio_wrap_xblock(xblock, view, frag, context, display_name_only=False):
|
||||
is_reorderable = _is_xblock_reorderable(xblock, context)
|
||||
selected_groups_label = get_visibility_partition_info(xblock)['selected_groups_label']
|
||||
if selected_groups_label:
|
||||
selected_groups_label = _('Visible to: {list_of_groups}').format(list_of_groups=selected_groups_label)
|
||||
selected_groups_label = _('Access restricted to: {list_of_groups}').format(list_of_groups=selected_groups_label)
|
||||
template_context = {
|
||||
'xblock_context': context,
|
||||
'xblock': xblock,
|
||||
|
||||
@@ -1,20 +1,15 @@
|
||||
"""
|
||||
Public views
|
||||
"""
|
||||
from django.views.decorators.csrf import ensure_csrf_cookie
|
||||
from django.views.decorators.clickjacking import xframe_options_deny
|
||||
from django.conf import settings
|
||||
from django.core.context_processors import csrf
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.shortcuts import redirect
|
||||
from django.conf import settings
|
||||
from django.views.decorators.clickjacking import xframe_options_deny
|
||||
from django.views.decorators.csrf import ensure_csrf_cookie
|
||||
|
||||
from edxmako.shortcuts import render_to_response
|
||||
|
||||
from openedx.core.djangoapps.external_auth.views import (
|
||||
ssl_login_shortcut,
|
||||
ssl_get_cert_from_request,
|
||||
redirect_with_get,
|
||||
)
|
||||
from openedx.core.djangoapps.external_auth.views import redirect_with_get, ssl_get_cert_from_request, ssl_login_shortcut
|
||||
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
|
||||
|
||||
__all__ = ['signup', 'login_page', 'howitworks']
|
||||
|
||||
@@ -1,20 +1,19 @@
|
||||
"""
|
||||
Views related to course tabs
|
||||
"""
|
||||
from student.auth import has_course_author_access
|
||||
from util.json_request import expect_json, JsonResponse
|
||||
|
||||
from django.http import HttpResponseNotFound
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.http import HttpResponseNotFound
|
||||
from django.views.decorators.csrf import ensure_csrf_cookie
|
||||
from django.views.decorators.http import require_http_methods
|
||||
from opaque_keys.edx.keys import CourseKey, UsageKey
|
||||
|
||||
from edxmako.shortcuts import render_to_response
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from student.auth import has_course_author_access
|
||||
from util.json_request import JsonResponse, expect_json
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.tabs import CourseTabList, CourseTab, InvalidTabsException, StaticTab
|
||||
from opaque_keys.edx.keys import CourseKey, UsageKey
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.tabs import CourseTab, CourseTabList, InvalidTabsException, StaticTab
|
||||
|
||||
from ..utils import get_lms_link_for_item
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
"""
|
||||
Tests access.py
|
||||
"""
|
||||
from django.test import TestCase
|
||||
from django.contrib.auth.models import User
|
||||
from django.test import TestCase
|
||||
from opaque_keys.edx.locations import SlashSeparatedCourseKey
|
||||
|
||||
from contentstore.views.access import get_user_role
|
||||
from student.auth import add_users
|
||||
from student.roles import CourseInstructorRole, CourseStaffRole
|
||||
from student.tests.factories import AdminFactory
|
||||
from student.auth import add_users
|
||||
from contentstore.views.access import get_user_role
|
||||
from opaque_keys.edx.locations import SlashSeparatedCourseKey
|
||||
|
||||
|
||||
class RolesTest(TestCase):
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user