Commit e0ef561c by Tyler Hallada

Run isort on cms/

Make sure safe_lxml is imported first for security
parent 90d7e96b
...@@ -10,6 +10,7 @@ from __future__ import absolute_import, unicode_literals ...@@ -10,6 +10,7 @@ from __future__ import absolute_import, unicode_literals
import importlib import importlib
import os import os
import contracts import contracts
import pytest import pytest
......
...@@ -3,14 +3,15 @@ import datetime ...@@ -3,14 +3,15 @@ import datetime
import ddt import ddt
import pytz import pytz
from django.test import RequestFactory from django.test import RequestFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
from openedx.core.lib.courses import course_image_url from openedx.core.lib.courses import course_image_url
from student.roles import CourseInstructorRole, CourseStaffRole from student.roles import CourseInstructorRole, CourseStaffRole
from student.tests.factories import UserFactory from student.tests.factories import UserFactory
from ..utils import serialize_datetime from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
from ...serializers.course_runs import CourseRunSerializer from ...serializers.course_runs import CourseRunSerializer
from ..utils import serialize_datetime
@ddt.ddt @ddt.ddt
......
...@@ -7,6 +7,10 @@ from django.core.urlresolvers import reverse ...@@ -7,6 +7,10 @@ from django.core.urlresolvers import reverse
from django.test import RequestFactory from django.test import RequestFactory
from opaque_keys.edx.keys import CourseKey from opaque_keys.edx.keys import CourseKey
from rest_framework.test import APIClient from rest_framework.test import APIClient
from openedx.core.lib.courses import course_image_url
from student.models import CourseAccessRole
from student.tests.factories import TEST_PASSWORD, AdminFactory, UserFactory
from xmodule.contentstore.content import StaticContent from xmodule.contentstore.content import StaticContent
from xmodule.contentstore.django import contentstore from xmodule.contentstore.django import contentstore
from xmodule.exceptions import NotFoundError from xmodule.exceptions import NotFoundError
...@@ -14,11 +18,8 @@ from xmodule.modulestore.django import modulestore ...@@ -14,11 +18,8 @@ from xmodule.modulestore.django import modulestore
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ToyCourseFactory from xmodule.modulestore.tests.factories import CourseFactory, ToyCourseFactory
from openedx.core.lib.courses import course_image_url
from student.models import CourseAccessRole
from student.tests.factories import AdminFactory, TEST_PASSWORD, UserFactory
from ..utils import serialize_datetime
from ...serializers.course_runs import CourseRunSerializer from ...serializers.course_runs import CourseRunSerializer
from ..utils import serialize_datetime
@ddt.ddt @ddt.ddt
......
...@@ -8,6 +8,7 @@ from rest_framework.decorators import detail_route ...@@ -8,6 +8,7 @@ from rest_framework.decorators import detail_route
from rest_framework.response import Response from rest_framework.response import Response
from contentstore.views.course import _accessible_courses_iter, get_course_and_check_access from contentstore.views.course import _accessible_courses_iter, get_course_and_check_access
from ..serializers.course_runs import ( from ..serializers.course_runs import (
CourseRunCreateSerializer, CourseRunCreateSerializer,
CourseRunImageSerializer, CourseRunImageSerializer,
......
...@@ -6,7 +6,7 @@ from config_models.admin import ConfigurationModelAdmin, KeyedConfigurationModel ...@@ -6,7 +6,7 @@ from config_models.admin import ConfigurationModelAdmin, KeyedConfigurationModel
from django.contrib import admin from django.contrib import admin
from contentstore.config.forms import CourseNewAssetsPageAdminForm from contentstore.config.forms import CourseNewAssetsPageAdminForm
from contentstore.config.models import NewAssetsPageFlag, CourseNewAssetsPageFlag from contentstore.config.models import CourseNewAssetsPageFlag, NewAssetsPageFlag
from contentstore.models import PushNotificationConfig, VideoUploadConfig from contentstore.models import PushNotificationConfig, VideoUploadConfig
......
...@@ -9,14 +9,14 @@ from datetime import datetime ...@@ -9,14 +9,14 @@ from datetime import datetime
from urllib import urlencode from urllib import urlencode
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from path import Path as path
from mock import patch from mock import patch
from path import Path as path
from rest_framework import status from rest_framework import status
from rest_framework.test import APITestCase from rest_framework.test import APITestCase
from user_tasks.models import UserTaskStatus
from lms.djangoapps.courseware.tests.factories import GlobalStaffFactory, StaffFactory from lms.djangoapps.courseware.tests.factories import GlobalStaffFactory, StaffFactory
from student.tests.factories import UserFactory from student.tests.factories import UserFactory
from user_tasks.models import UserTaskStatus
from xmodule.modulestore.tests.django_utils import TEST_DATA_SPLIT_MODULESTORE, SharedModuleStoreTestCase from xmodule.modulestore.tests.django_utils import TEST_DATA_SPLIT_MODULESTORE, SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory from xmodule.modulestore.tests.factories import CourseFactory
......
...@@ -3,24 +3,21 @@ import base64 ...@@ -3,24 +3,21 @@ import base64
import logging import logging
import os import os
from path import Path as path
from six import text_type
from django.conf import settings from django.conf import settings
from django.core.files import File from django.core.files import File
from opaque_keys.edx.keys import CourseKey from opaque_keys.edx.keys import CourseKey
from path import Path as path
from rest_framework import status from rest_framework import status
from rest_framework.exceptions import AuthenticationFailed from rest_framework.exceptions import AuthenticationFailed
from rest_framework.generics import GenericAPIView from rest_framework.generics import GenericAPIView
from rest_framework.response import Response from rest_framework.response import Response
from six import text_type
from user_tasks.models import UserTaskStatus from user_tasks.models import UserTaskStatus
from student.auth import has_course_author_access
from contentstore.storage import course_import_export_storage from contentstore.storage import course_import_export_storage
from contentstore.tasks import CourseImportTask, import_olx from contentstore.tasks import CourseImportTask, import_olx
from openedx.core.lib.api.view_utils import DeveloperErrorViewMixin, view_auth_classes from openedx.core.lib.api.view_utils import DeveloperErrorViewMixin, view_auth_classes
from student.auth import has_course_author_access
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
......
...@@ -4,12 +4,11 @@ Defines a form for providing validation. ...@@ -4,12 +4,11 @@ Defines a form for providing validation.
import logging import logging
from django import forms from django import forms
from opaque_keys import InvalidKeyError
from opaque_keys.edx.locator import CourseLocator
from contentstore.config.models import CourseNewAssetsPageFlag from contentstore.config.models import CourseNewAssetsPageFlag
from opaque_keys import InvalidKeyError
from xmodule.modulestore.django import modulestore from xmodule.modulestore.django import modulestore
from opaque_keys.edx.locator import CourseLocator
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
......
...@@ -4,6 +4,7 @@ controlling the new assets page. ...@@ -4,6 +4,7 @@ controlling the new assets page.
""" """
from config_models.models import ConfigurationModel from config_models.models import ConfigurationModel
from django.db.models import BooleanField from django.db.models import BooleanField
from openedx.core.djangoapps.xmodule_django.models import CourseKeyField from openedx.core.djangoapps.xmodule_django.models import CourseKeyField
......
...@@ -4,7 +4,7 @@ to configure flags related to persistent grading. ...@@ -4,7 +4,7 @@ to configure flags related to persistent grading.
""" """
from contextlib import contextmanager from contextlib import contextmanager
from contentstore.config.models import NewAssetsPageFlag, CourseNewAssetsPageFlag from contentstore.config.models import CourseNewAssetsPageFlag, NewAssetsPageFlag
from request_cache.middleware import RequestCache from request_cache.middleware import RequestCache
......
...@@ -10,12 +10,12 @@ from django.conf import settings ...@@ -10,12 +10,12 @@ from django.conf import settings
from django.core.urlresolvers import resolve from django.core.urlresolvers import resolve
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from django.utils.translation import ugettext_lazy from django.utils.translation import ugettext_lazy
from eventtracking import tracker
from search.search_engine_base import SearchEngine from search.search_engine_base import SearchEngine
from six import add_metaclass from six import add_metaclass
from contentstore.course_group_config import GroupConfiguration from contentstore.course_group_config import GroupConfiguration
from course_modes.models import CourseMode from course_modes.models import CourseMode
from eventtracking import tracker
from openedx.core.lib.courses import course_image_url from openedx.core.lib.courses import course_image_url
from xmodule.annotator_mixin import html_to_text from xmodule.annotator_mixin import html_to_text
from xmodule.library_tools import normalize_key_for_search from xmodule.library_tools import normalize_key_for_search
......
...@@ -6,7 +6,6 @@ from lettuce import step, world ...@@ -6,7 +6,6 @@ from lettuce import step, world
from common import * from common import *
############### ACTIONS #################### ############### ACTIONS ####################
......
...@@ -4,11 +4,11 @@ erroneous certificate names. ...@@ -4,11 +4,11 @@ erroneous certificate names.
""" """
from collections import namedtuple from collections import namedtuple
from six.moves import input
from six import text_type
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from six import text_type
from six.moves import input
from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.django import modulestore from xmodule.modulestore.django import modulestore
......
""" """
Django management command to create a course in a specific modulestore Django management command to create a course in a specific modulestore
""" """
from six import text_type
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.core.management.base import BaseCommand, CommandError from django.core.management.base import BaseCommand, CommandError
from six import text_type
from contentstore.management.commands.utils import user_from_str from contentstore.management.commands.utils import user_from_str
from contentstore.views.course import create_new_course_in_store from contentstore.views.course import create_new_course_in_store
from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore import ModuleStoreEnum
MODULESTORE_CHOICES = (ModuleStoreEnum.Type.mongo, ModuleStoreEnum.Type.split) MODULESTORE_CHOICES = (ModuleStoreEnum.Type.mongo, ModuleStoreEnum.Type.split)
......
from __future__ import print_function from __future__ import print_function
from six import text_type
from django.core.management.base import BaseCommand, CommandError from django.core.management.base import BaseCommand, CommandError
from opaque_keys import InvalidKeyError from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey from opaque_keys.edx.keys import CourseKey
from six import text_type
from contentstore.utils import delete_course from contentstore.utils import delete_course
from xmodule.contentstore.django import contentstore from xmodule.contentstore.django import contentstore
from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.django import modulestore from xmodule.modulestore.django import modulestore
from .prompt import query_yes_no from .prompt import query_yes_no
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
Script for exporting courseware from Mongo to a tar.gz file Script for exporting courseware from Mongo to a tar.gz file
""" """
from __future__ import print_function from __future__ import print_function
import os import os
from django.core.management.base import BaseCommand, CommandError from django.core.management.base import BaseCommand, CommandError
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
Script for exporting all courseware from Mongo to a directory and listing the courses which failed to export Script for exporting all courseware from Mongo to a directory and listing the courses which failed to export
""" """
from __future__ import print_function from __future__ import print_function
from six import text_type
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from six import text_type
from xmodule.contentstore.django import contentstore from xmodule.contentstore.django import contentstore
from xmodule.modulestore.django import modulestore from xmodule.modulestore.django import modulestore
......
...@@ -7,7 +7,6 @@ from opaque_keys.edx.keys import CourseKey ...@@ -7,7 +7,6 @@ from opaque_keys.edx.keys import CourseKey
from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.django import modulestore from xmodule.modulestore.django import modulestore
# To run from command line: ./manage.py cms fix_not_found course-v1:org+course+run # To run from command line: ./manage.py cms fix_not_found course-v1:org+course+run
......
...@@ -11,7 +11,6 @@ from xmodule.modulestore.django import modulestore ...@@ -11,7 +11,6 @@ from xmodule.modulestore.django import modulestore
from .prompt import query_yes_no from .prompt import query_yes_no
from .utils import get_course_versions from .utils import get_course_versions
# To run from command line: ./manage.py cms force_publish course-v1:org+course+run # To run from command line: ./manage.py cms force_publish course-v1:org+course+run
......
...@@ -3,10 +3,10 @@ Django management command to generate a test course from a course config json ...@@ -3,10 +3,10 @@ Django management command to generate a test course from a course config json
""" """
import json import json
import logging import logging
from six import text_type
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.core.management.base import BaseCommand, CommandError from django.core.management.base import BaseCommand, CommandError
from six import text_type
from contentstore.management.commands.utils import user_from_str from contentstore.management.commands.utils import user_from_str
from contentstore.views.course import create_new_course_in_store from contentstore.views.course import create_new_course_in_store
......
...@@ -14,12 +14,12 @@ attribute is set and the FEATURE['ENABLE_EXPORT_GIT'] is set. ...@@ -14,12 +14,12 @@ attribute is set and the FEATURE['ENABLE_EXPORT_GIT'] is set.
""" """
import logging import logging
from six import text_type
from django.core.management.base import BaseCommand, CommandError from django.core.management.base import BaseCommand, CommandError
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from opaque_keys import InvalidKeyError from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey from opaque_keys.edx.keys import CourseKey
from six import text_type
import contentstore.git_export_utils as git_export_utils import contentstore.git_export_utils as git_export_utils
from contentstore.git_export_utils import GitExportError from contentstore.git_export_utils import GitExportError
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
Script for importing courseware from XML format Script for importing courseware from XML format
""" """
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from django_comment_common.utils import are_permissions_roles_seeded, seed_permissions_roles from django_comment_common.utils import are_permissions_roles_seeded, seed_permissions_roles
from xmodule.contentstore.django import contentstore from xmodule.contentstore.django import contentstore
from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore import ModuleStoreEnum
......
""" Management command to update libraries' search index """ """ Management command to update libraries' search index """
from __future__ import print_function from __future__ import print_function
from textwrap import dedent from textwrap import dedent
from django.core.management import BaseCommand, CommandError from django.core.management import BaseCommand, CommandError
......
...@@ -2,17 +2,17 @@ ...@@ -2,17 +2,17 @@
Test for assets cleanup of courses for Mac OS metadata files (with filename ".DS_Store" Test for assets cleanup of courses for Mac OS metadata files (with filename ".DS_Store"
or with filename which starts with "._") or with filename which starts with "._")
""" """
from django.conf import settings
from django.core.management import call_command from django.core.management import call_command
from opaque_keys.edx.keys import CourseKey from opaque_keys.edx.keys import CourseKey
from xmodule.contentstore.content import XASSET_LOCATION_TAG from xmodule.contentstore.content import XASSET_LOCATION_TAG
from xmodule.contentstore.django import contentstore from xmodule.contentstore.django import contentstore
from xmodule.modulestore.django import modulestore
from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.mongo.base import location_to_query from xmodule.modulestore.mongo.base import location_to_query
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.xml_importer import import_course_from_xml from xmodule.modulestore.xml_importer import import_course_from_xml
from django.conf import settings
TEST_DATA_DIR = settings.COMMON_TEST_DATA_ROOT TEST_DATA_DIR = settings.COMMON_TEST_DATA_ROOT
......
...@@ -6,8 +6,8 @@ from django.core.management import CommandError, call_command ...@@ -6,8 +6,8 @@ from django.core.management import CommandError, call_command
from django.test import TestCase from django.test import TestCase
from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.django import modulestore from xmodule.modulestore.django import modulestore
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
class TestArgParsing(TestCase): class TestArgParsing(TestCase):
......
...@@ -6,7 +6,7 @@ from student.tests.factories import UserFactory ...@@ -6,7 +6,7 @@ from student.tests.factories import UserFactory
from xmodule.contentstore.content import StaticContent from xmodule.contentstore.content import StaticContent
from xmodule.contentstore.django import contentstore from xmodule.contentstore.django import contentstore
from xmodule.modulestore.django import modulestore from xmodule.modulestore.django import modulestore
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase, TEST_DATA_SPLIT_MODULESTORE from xmodule.modulestore.tests.django_utils import TEST_DATA_SPLIT_MODULESTORE, ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory from xmodule.modulestore.tests.factories import CourseFactory
......
"""Tests running the delete_orphan command""" """Tests running the delete_orphan command"""
import ddt import ddt
from django.core.management import call_command, CommandError from django.core.management import CommandError, call_command
from contentstore.tests.test_orphan import TestOrphanBase
from xmodule.modulestore.tests.factories import CourseFactory from contentstore.tests.test_orphan import TestOrphanBase
from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.tests.factories import CourseFactory
@ddt.ddt @ddt.ddt
......
""" """
Tests for exporting courseware to the desired path Tests for exporting courseware to the desired path
""" """
import unittest
import shutil import shutil
import unittest
from tempfile import mkdtemp
import ddt import ddt
from django.core.management import CommandError, call_command from django.core.management import CommandError, call_command
from tempfile import mkdtemp
from xmodule.modulestore.tests.factories import CourseFactory
from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.django import modulestore from xmodule.modulestore.django import modulestore
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
class TestArgParsingCourseExport(unittest.TestCase): class TestArgParsingCourseExport(unittest.TestCase):
......
...@@ -5,7 +5,6 @@ import shutil ...@@ -5,7 +5,6 @@ import shutil
from tempfile import mkdtemp from tempfile import mkdtemp
from contentstore.management.commands.export_all_courses import export_courses_to_output_path from contentstore.management.commands.export_all_courses import export_courses_to_output_path
from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.django import modulestore from xmodule.modulestore.django import modulestore
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
......
...@@ -2,20 +2,20 @@ ...@@ -2,20 +2,20 @@
Tests for exporting OLX content. Tests for exporting OLX content.
""" """
import ddt
from path import Path as path
import shutil import shutil
from StringIO import StringIO
import tarfile import tarfile
from tempfile import mkdtemp
import unittest import unittest
from StringIO import StringIO
from tempfile import mkdtemp
import ddt
from django.core.management import CommandError, call_command from django.core.management import CommandError, call_command
from path import Path as path
from xmodule.modulestore.tests.factories import CourseFactory
from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.django import modulestore from xmodule.modulestore.django import modulestore
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
class TestArgParsingCourseExportOlx(unittest.TestCase): class TestArgParsingCourseExportOlx(unittest.TestCase):
......
...@@ -3,6 +3,7 @@ Tests for the fix_not_found management command ...@@ -3,6 +3,7 @@ Tests for the fix_not_found management command
""" """
from django.core.management import CommandError, call_command from django.core.management import CommandError, call_command
from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
......
...@@ -2,12 +2,13 @@ ...@@ -2,12 +2,13 @@
Tests for the force_publish management command Tests for the force_publish management command
""" """
import mock import mock
from django.core.management import call_command, CommandError from django.core.management import CommandError, call_command
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase, ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from contentstore.management.commands.force_publish import Command from contentstore.management.commands.force_publish import Command
from contentstore.management.commands.utils import get_course_versions from contentstore.management.commands.utils import get_course_versions
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase, SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
class TestForcePublish(SharedModuleStoreTestCase): class TestForcePublish(SharedModuleStoreTestCase):
......
...@@ -14,11 +14,11 @@ from django.conf import settings ...@@ -14,11 +14,11 @@ from django.conf import settings
from django.core.management import call_command from django.core.management import call_command
from django.core.management.base import CommandError from django.core.management.base import CommandError
from django.test.utils import override_settings from django.test.utils import override_settings
from opaque_keys.edx.locator import CourseLocator
from contentstore.tests.utils import CourseTestCase
import contentstore.git_export_utils as git_export_utils import contentstore.git_export_utils as git_export_utils
from contentstore.git_export_utils import GitExportError from contentstore.git_export_utils import GitExportError
from opaque_keys.edx.locator import CourseLocator from contentstore.tests.utils import CourseTestCase
FEATURES_WITH_EXPORT_GIT = settings.FEATURES.copy() FEATURES_WITH_EXPORT_GIT = settings.FEATURES.copy()
FEATURES_WITH_EXPORT_GIT['ENABLE_EXPORT_GIT'] = True FEATURES_WITH_EXPORT_GIT['ENABLE_EXPORT_GIT'] = True
......
...@@ -3,15 +3,15 @@ Unittests for importing a course via management command ...@@ -3,15 +3,15 @@ Unittests for importing a course via management command
""" """
import os import os
from path import Path as path
import shutil import shutil
import tempfile import tempfile
from django.core.management import call_command from django.core.management import call_command
from path import Path as path
from django_comment_common.utils import are_permissions_roles_seeded from django_comment_common.utils import are_permissions_roles_seeded
from xmodule.modulestore.django import modulestore
from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
......
...@@ -3,11 +3,12 @@ Unittests for migrating a course to split mongo ...@@ -3,11 +3,12 @@ Unittests for migrating a course to split mongo
""" """
from django.core.management import CommandError, call_command from django.core.management import CommandError, call_command
from django.test import TestCase from django.test import TestCase
from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
from xmodule.modulestore.django import modulestore from xmodule.modulestore.django import modulestore
from xmodule.modulestore.exceptions import ItemNotFoundError from xmodule.modulestore.exceptions import ItemNotFoundError
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
class TestArgParsing(TestCase): class TestArgParsing(TestCase):
......
""" Tests for course reindex command """ """ Tests for course reindex command """
import ddt import ddt
from django.core.management import call_command, CommandError
import mock import mock
from django.core.management import CommandError, call_command
from six import text_type from six import text_type
from contentstore.courseware_index import SearchIndexingError
from contentstore.management.commands.reindex_course import Command as ReindexCommand
from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.django import modulestore from xmodule.modulestore.django import modulestore
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, LibraryFactory from xmodule.modulestore.tests.factories import CourseFactory, LibraryFactory
from contentstore.management.commands.reindex_course import Command as ReindexCommand
from contentstore.courseware_index import SearchIndexingError
@ddt.ddt @ddt.ddt
class TestReindexCourse(ModuleStoreTestCase): class TestReindexCourse(ModuleStoreTestCase):
......
""" Tests for library reindex command """ """ Tests for library reindex command """
import ddt import ddt
from django.core.management import call_command, CommandError
import mock import mock
from django.core.management import CommandError, call_command
from opaque_keys import InvalidKeyError
from contentstore.courseware_index import SearchIndexingError
from contentstore.management.commands.reindex_library import Command as ReindexCommand
from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.django import modulestore from xmodule.modulestore.django import modulestore
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, LibraryFactory from xmodule.modulestore.tests.factories import CourseFactory, LibraryFactory
from opaque_keys import InvalidKeyError
from contentstore.management.commands.reindex_library import Command as ReindexCommand
from contentstore.courseware_index import SearchIndexingError
@ddt.ddt @ddt.ddt
class TestReindexLibrary(ModuleStoreTestCase): class TestReindexLibrary(ModuleStoreTestCase):
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
Verify the structure of courseware as to it's suitability for import Verify the structure of courseware as to it's suitability for import
""" """
from __future__ import print_function from __future__ import print_function
from argparse import REMAINDER from argparse import REMAINDER
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
......
...@@ -6,12 +6,12 @@ from logging import exception as log_exception ...@@ -6,12 +6,12 @@ from logging import exception as log_exception
from uuid import uuid4 from uuid import uuid4
from django.conf import settings from django.conf import settings
from contentstore.models import PushNotificationConfig
from contentstore.tasks import push_course_update_task
from parse_rest.connection import register from parse_rest.connection import register
from parse_rest.core import ParseError from parse_rest.core import ParseError
from parse_rest.installation import Push from parse_rest.installation import Push
from contentstore.models import PushNotificationConfig
from contentstore.tasks import push_course_update_task
from xmodule.modulestore.django import modulestore from xmodule.modulestore.django import modulestore
......
""" receivers of course_published and library_updated events in order to trigger indexing task """ """ receivers of course_published and library_updated events in order to trigger indexing task """
import logging
from datetime import datetime from datetime import datetime
from functools import wraps from functools import wraps
import logging
from django.core.cache import cache from django.core.cache import cache
from django.dispatch import receiver from django.dispatch import receiver
...@@ -15,9 +15,9 @@ from openedx.core.djangoapps.credit.signals import on_course_publish ...@@ -15,9 +15,9 @@ from openedx.core.djangoapps.credit.signals import on_course_publish
from openedx.core.lib.gating import api as gating_api from openedx.core.lib.gating import api as gating_api
from track.event_transaction_utils import get_event_transaction_id, get_event_transaction_type from track.event_transaction_utils import get_event_transaction_id, get_event_transaction_type
from util.module_utils import yield_dynamic_descriptor_descendants from util.module_utils import yield_dynamic_descriptor_descendants
from .signals import GRADING_POLICY_CHANGED
from xmodule.modulestore.django import SignalHandler, modulestore from xmodule.modulestore.django import SignalHandler, modulestore
from .signals import GRADING_POLICY_CHANGED
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
......
...@@ -25,10 +25,10 @@ from opaque_keys.edx.locations import AssetLocation, CourseLocator ...@@ -25,10 +25,10 @@ from opaque_keys.edx.locations import AssetLocation, CourseLocator
from path import Path as path from path import Path as path
from waffle.testutils import override_switch from waffle.testutils import override_switch
from contentstore.config import waffle
from contentstore.tests.utils import AjaxEnabledTestClient, CourseTestCase, get_url, parse_json from contentstore.tests.utils import AjaxEnabledTestClient, CourseTestCase, get_url, parse_json
from contentstore.utils import delete_course, reverse_course_url, reverse_url from contentstore.utils import delete_course, reverse_course_url, reverse_url
from contentstore.views.component import ADVANCED_COMPONENT_TYPES from contentstore.views.component import ADVANCED_COMPONENT_TYPES
from contentstore.config import waffle
from course_action_state.managers import CourseActionStateItemNotFoundError from course_action_state.managers import CourseActionStateItemNotFoundError
from course_action_state.models import CourseRerunState, CourseRerunUIStateManager from course_action_state.models import CourseRerunState, CourseRerunUIStateManager
from django_comment_common.utils import are_permissions_roles_seeded from django_comment_common.utils import are_permissions_roles_seeded
......
...@@ -10,13 +10,13 @@ import ddt ...@@ -10,13 +10,13 @@ import ddt
import mock import mock
from django.conf import settings from django.conf import settings
from django.test.utils import override_settings from django.test.utils import override_settings
from pytz import UTC from milestones.models import MilestoneRelationshipType
from milestones.tests.utils import MilestonesTestCaseMixin from milestones.tests.utils import MilestonesTestCaseMixin
from mock import Mock, patch from mock import Mock, patch
from pytz import UTC
from contentstore.utils import reverse_course_url, reverse_usage_url from contentstore.utils import reverse_course_url, reverse_usage_url
from milestones.models import MilestoneRelationshipType from models.settings.course_grading import GRADING_POLICY_CHANGED_EVENT_TYPE, CourseGradingModel, hash_grading_policy
from models.settings.course_grading import CourseGradingModel, GRADING_POLICY_CHANGED_EVENT_TYPE, hash_grading_policy
from models.settings.course_metadata import CourseMetadata from models.settings.course_metadata import CourseMetadata
from models.settings.encoder import CourseSettingsEncoder from models.settings.encoder import CourseSettingsEncoder
from openedx.core.djangoapps.models.course_details import CourseDetails from openedx.core.djangoapps.models.course_details import CourseDetails
......
import ddt import ddt
from mock import patch, Mock from mock import Mock, patch
from cms.djangoapps.contentstore.signals.handlers import ( from cms.djangoapps.contentstore.signals.handlers import GRADING_POLICY_COUNTDOWN_SECONDS, handle_grading_policy_changed
GRADING_POLICY_COUNTDOWN_SECONDS,
handle_grading_policy_changed
)
from student.models import CourseEnrollment from student.models import CourseEnrollment
from student.tests.factories import UserFactory from student.tests.factories import UserFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
""" Tests for transcripts_utils. """ """ Tests for transcripts_utils. """
import copy import copy
import ddt
import textwrap import textwrap
import unittest import unittest
from uuid import uuid4 from uuid import uuid4
import ddt
from django.conf import settings from django.conf import settings
from django.test.utils import override_settings from django.test.utils import override_settings
from django.utils import translation from django.utils import translation
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
This test file will test registration, login, activation, and session activity timeouts This test file will test registration, login, activation, and session activity timeouts
""" """
from __future__ import print_function from __future__ import print_function
import datetime import datetime
import time import time
...@@ -16,11 +17,11 @@ from django.test import TestCase ...@@ -16,11 +17,11 @@ from django.test import TestCase
from django.test.utils import override_settings from django.test.utils import override_settings
from freezegun import freeze_time from freezegun import freeze_time
from pytz import UTC from pytz import UTC
from six.moves import xrange
from contentstore.models import PushNotificationConfig from contentstore.models import PushNotificationConfig
from contentstore.tests.test_course_settings import CourseTestCase from contentstore.tests.test_course_settings import CourseTestCase
from contentstore.tests.utils import AjaxEnabledTestClient, parse_json, registration, user from contentstore.tests.utils import AjaxEnabledTestClient, parse_json, registration, user
from six.moves import xrange
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory from xmodule.modulestore.tests.factories import CourseFactory
......
...@@ -9,14 +9,9 @@ from django.core.exceptions import PermissionDenied ...@@ -9,14 +9,9 @@ from django.core.exceptions import PermissionDenied
from django.http import HttpResponseBadRequest, HttpResponseNotFound from django.http import HttpResponseBadRequest, HttpResponseNotFound
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from django.views.decorators.csrf import ensure_csrf_cookie from django.views.decorators.csrf import ensure_csrf_cookie
from django.views.decorators.http import require_POST, require_http_methods from django.views.decorators.http import require_http_methods, require_POST
from opaque_keys.edx.keys import AssetKey, CourseKey from opaque_keys.edx.keys import AssetKey, CourseKey
from pymongo import ASCENDING, DESCENDING from pymongo import ASCENDING, DESCENDING
from xmodule.contentstore.content import StaticContent
from xmodule.contentstore.django import contentstore
from xmodule.exceptions import NotFoundError
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.exceptions import ItemNotFoundError
from contentstore.config.models import NewAssetsPageFlag from contentstore.config.models import NewAssetsPageFlag
from contentstore.utils import reverse_course_url from contentstore.utils import reverse_course_url
...@@ -26,6 +21,11 @@ from openedx.core.djangoapps.contentserver.caching import del_cached_content ...@@ -26,6 +21,11 @@ from openedx.core.djangoapps.contentserver.caching import del_cached_content
from student.auth import has_course_author_access from student.auth import has_course_author_access
from util.date_utils import get_default_time_display from util.date_utils import get_default_time_display
from util.json_request import JsonResponse from util.json_request import JsonResponse
from xmodule.contentstore.content import StaticContent
from xmodule.contentstore.django import contentstore
from xmodule.exceptions import NotFoundError
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.exceptions import ItemNotFoundError
__all__ = ['assets_handler'] __all__ = ['assets_handler']
......
...@@ -31,6 +31,7 @@ from django.http import HttpResponse ...@@ -31,6 +31,7 @@ from django.http import HttpResponse
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from django.views.decorators.csrf import ensure_csrf_cookie from django.views.decorators.csrf import ensure_csrf_cookie
from django.views.decorators.http import require_http_methods from django.views.decorators.http import require_http_methods
from eventtracking import tracker
from opaque_keys import InvalidKeyError from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import AssetKey, CourseKey from opaque_keys.edx.keys import AssetKey, CourseKey
...@@ -39,7 +40,6 @@ from contentstore.views.assets import delete_asset ...@@ -39,7 +40,6 @@ from contentstore.views.assets import delete_asset
from contentstore.views.exception import AssetNotFoundException from contentstore.views.exception import AssetNotFoundException
from course_modes.models import CourseMode from course_modes.models import CourseMode
from edxmako.shortcuts import render_to_response from edxmako.shortcuts import render_to_response
from eventtracking import tracker
from student.auth import has_studio_write_access from student.auth import has_studio_write_access
from student.roles import GlobalStaff from student.roles import GlobalStaff
from util.db import MYSQL_MAX_INT, generate_int_id from util.db import MYSQL_MAX_INT, generate_int_id
......
...@@ -19,11 +19,10 @@ from django.shortcuts import redirect ...@@ -19,11 +19,10 @@ from django.shortcuts import redirect
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from django.views.decorators.csrf import ensure_csrf_cookie from django.views.decorators.csrf import ensure_csrf_cookie
from django.views.decorators.http import require_GET, require_http_methods from django.views.decorators.http import require_GET, require_http_methods
from milestones import api as milestones_api
from opaque_keys import InvalidKeyError from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey from opaque_keys.edx.keys import CourseKey
from opaque_keys.edx.locations import Location from opaque_keys.edx.locations import Location
from openedx.core.djangoapps.content.course_overviews.models import CourseOverview
from openedx.core.djangoapps.waffle_utils import WaffleSwitchNamespace
from contentstore.course_group_config import ( from contentstore.course_group_config import (
COHORT_SCHEME, COHORT_SCHEME,
...@@ -51,16 +50,17 @@ from course_action_state.managers import CourseActionStateItemNotFoundError ...@@ -51,16 +50,17 @@ from course_action_state.managers import CourseActionStateItemNotFoundError
from course_action_state.models import CourseRerunState, CourseRerunUIStateManager from course_action_state.models import CourseRerunState, CourseRerunUIStateManager
from course_creators.views import add_user_with_status_unrequested, get_course_creator_status from course_creators.views import add_user_with_status_unrequested, get_course_creator_status
from edxmako.shortcuts import render_to_response from edxmako.shortcuts import render_to_response
from milestones import api as milestones_api
from models.settings.course_grading import CourseGradingModel from models.settings.course_grading import CourseGradingModel
from models.settings.course_metadata import CourseMetadata from models.settings.course_metadata import CourseMetadata
from models.settings.encoder import CourseSettingsEncoder from models.settings.encoder import CourseSettingsEncoder
from openedx.core.djangoapps.content.course_overviews.models import CourseOverview
from openedx.core.djangoapps.content.course_structures.api.v0 import api, errors from openedx.core.djangoapps.content.course_structures.api.v0 import api, errors
from openedx.core.djangoapps.credit.api import get_credit_requirements, is_credit_course 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.credit.tasks import update_credit_course_requirements
from openedx.core.djangoapps.models.course_details import CourseDetails from openedx.core.djangoapps.models.course_details import CourseDetails
from openedx.core.djangoapps.self_paced.models import SelfPacedConfiguration from openedx.core.djangoapps.self_paced.models import SelfPacedConfiguration
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
from openedx.core.djangoapps.waffle_utils import WaffleSwitchNamespace
from openedx.core.djangolib.js_utils import dump_js_escaped_json from openedx.core.djangolib.js_utils import dump_js_escaped_json
from openedx.core.lib.course_tabs import CourseTabPluginManager from openedx.core.lib.course_tabs import CourseTabPluginManager
from openedx.core.lib.courses import course_image_url from openedx.core.lib.courses import course_image_url
......
...@@ -8,6 +8,7 @@ import logging ...@@ -8,6 +8,7 @@ import logging
import os import os
import re import re
import shutil import shutil
from wsgiref.util import FileWrapper
from django.conf import settings from django.conf import settings
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
...@@ -24,7 +25,6 @@ from path import Path as path ...@@ -24,7 +25,6 @@ from path import Path as path
from six import text_type from six import text_type
from user_tasks.conf import settings as user_tasks_settings from user_tasks.conf import settings as user_tasks_settings
from user_tasks.models import UserTaskArtifact, UserTaskStatus from user_tasks.models import UserTaskArtifact, UserTaskStatus
from wsgiref.util import FileWrapper
from contentstore.storage import course_import_export_storage from contentstore.storage import course_import_export_storage
from contentstore.tasks import CourseExportTask, CourseImportTask, export_olx, import_olx from contentstore.tasks import CourseExportTask, CourseImportTask, export_olx, import_olx
......
...@@ -15,6 +15,7 @@ from django.core.exceptions import PermissionDenied ...@@ -15,6 +15,7 @@ from django.core.exceptions import PermissionDenied
from django.http import Http404, HttpResponse, HttpResponseBadRequest from django.http import Http404, HttpResponse, HttpResponseBadRequest
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from django.views.decorators.http import require_http_methods from django.views.decorators.http import require_http_methods
from help_tokens.core import HelpUrlExpert
from opaque_keys.edx.keys import CourseKey from opaque_keys.edx.keys import CourseKey
from opaque_keys.edx.locator import LibraryUsageLocator from opaque_keys.edx.locator import LibraryUsageLocator
from pytz import UTC from pytz import UTC
...@@ -46,7 +47,6 @@ from contentstore.views.helpers import ( ...@@ -46,7 +47,6 @@ from contentstore.views.helpers import (
) )
from contentstore.views.preview import get_preview_fragment from contentstore.views.preview import get_preview_fragment
from edxmako.shortcuts import render_to_string from edxmako.shortcuts import render_to_string
from help_tokens.core import HelpUrlExpert
from models.settings.course_grading import CourseGradingModel from models.settings.course_grading import CourseGradingModel
from openedx.core.djangoapps.schedules.config import COURSE_UPDATE_WAFFLE_FLAG from openedx.core.djangoapps.schedules.config import COURSE_UPDATE_WAFFLE_FLAG
from openedx.core.djangoapps.waffle_utils import WaffleSwitch from openedx.core.djangoapps.waffle_utils import WaffleSwitch
......
...@@ -2,17 +2,17 @@ ...@@ -2,17 +2,17 @@
Public views Public views
""" """
from django.conf import settings from django.conf import settings
from django.template.context_processors import csrf
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.shortcuts import redirect from django.shortcuts import redirect
from django.template.context_processors import csrf
from django.views.decorators.clickjacking import xframe_options_deny from django.views.decorators.clickjacking import xframe_options_deny
from django.views.decorators.csrf import ensure_csrf_cookie from django.views.decorators.csrf import ensure_csrf_cookie
from waffle.decorators import waffle_switch
from contentstore.config import waffle
from edxmako.shortcuts import render_to_response from edxmako.shortcuts import render_to_response
from openedx.core.djangoapps.external_auth.views import redirect_with_get, ssl_get_cert_from_request, ssl_login_shortcut 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 from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
from waffle.decorators import waffle_switch
from contentstore.config import waffle
__all__ = ['signup', 'login_page', 'howitworks', 'accessibility'] __all__ = ['signup', 'login_page', 'howitworks', 'accessibility']
......
...@@ -18,12 +18,12 @@ from search.api import perform_search ...@@ -18,12 +18,12 @@ from search.api import perform_search
from contentstore.courseware_index import CoursewareSearchIndexer, SearchIndexingError from contentstore.courseware_index import CoursewareSearchIndexer, SearchIndexingError
from contentstore.tests.utils import CourseTestCase from contentstore.tests.utils import CourseTestCase
from contentstore.utils import add_instructor, reverse_course_url, reverse_usage_url from contentstore.utils import add_instructor, reverse_course_url, reverse_usage_url
from contentstore.views.course import WAFFLE_NAMESPACE as COURSE_WAFFLE_NAMESPACE
from contentstore.views.course import ( from contentstore.views.course import (
_deprecated_blocks_info, _deprecated_blocks_info,
course_outline_initial_state, course_outline_initial_state,
reindex_course_and_check_access reindex_course_and_check_access
) )
from contentstore.views.course import WAFFLE_NAMESPACE as COURSE_WAFFLE_NAMESPACE
from contentstore.views.item import VisibilityState, create_xblock_info from contentstore.views.item import VisibilityState, create_xblock_info
from course_action_state.managers import CourseRerunUIStateManager from course_action_state.managers import CourseRerunUIStateManager
from course_action_state.models import CourseRerunState from course_action_state.models import CourseRerunState
......
...@@ -4,18 +4,19 @@ ...@@ -4,18 +4,19 @@
Group Configuration Tests. Group Configuration Tests.
""" """
import json import json
from operator import itemgetter
import ddt import ddt
from mock import patch from mock import patch
from operator import itemgetter
from contentstore.utils import reverse_course_url, reverse_usage_url from contentstore.course_group_config import CONTENT_GROUP_CONFIGURATION_NAME, GroupConfiguration
from contentstore.course_group_config import GroupConfiguration, CONTENT_GROUP_CONFIGURATION_NAME
from contentstore.tests.utils import CourseTestCase from contentstore.tests.utils import CourseTestCase
from xmodule.partitions.partitions import Group, UserPartition from contentstore.utils import reverse_course_url, reverse_usage_url
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from xmodule.partitions.partitions import Group, UserPartition
from xmodule.validation import StudioValidation, StudioValidationMessage from xmodule.validation import StudioValidation, StudioValidationMessage
from xmodule.modulestore.django import modulestore
from xmodule.modulestore import ModuleStoreEnum
GROUP_CONFIGURATION_JSON = { GROUP_CONFIGURATION_JSON = {
u'name': u'Test name', u'name': u'Test name',
......
...@@ -34,7 +34,7 @@ from contentstore.views.item import ( ...@@ -34,7 +34,7 @@ from contentstore.views.item import (
_xblock_type_and_display_name, _xblock_type_and_display_name,
add_container_page_publishing_info, add_container_page_publishing_info,
create_xblock_info, create_xblock_info,
highlights_setting, highlights_setting
) )
from lms_xblock.mixin import NONSENSICAL_ACCESS_RESTRICTION from lms_xblock.mixin import NONSENSICAL_ACCESS_RESTRICTION
from openedx.core.djangoapps.self_paced.models import SelfPacedConfiguration from openedx.core.djangoapps.self_paced.models import SelfPacedConfiguration
......
import ddt
import json import json
from mock import Mock, patch
import ddt
from django.test.testcases import TestCase from django.test.testcases import TestCase
from mock import Mock, patch
from contentstore.tests.utils import CourseTestCase from contentstore.tests.utils import CourseTestCase
from contentstore.utils import reverse_course_url from contentstore.utils import reverse_course_url
......
"""Tests for items views.""" """Tests for items views."""
import copy import copy
import ddt
import json import json
import os import os
import tempfile import tempfile
import textwrap import textwrap
from uuid import uuid4 from uuid import uuid4
import ddt
from django.conf import settings from django.conf import settings
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.test.utils import override_settings from django.test.utils import override_settings
from mock import patch, Mock from mock import Mock, patch
from opaque_keys.edx.keys import UsageKey from opaque_keys.edx.keys import UsageKey
from contentstore.tests.utils import CourseTestCase, mock_requests_get from contentstore.tests.utils import CourseTestCase, mock_requests_get
......
...@@ -15,24 +15,31 @@ import pytz ...@@ -15,24 +15,31 @@ import pytz
from django.conf import settings from django.conf import settings
from django.core.files.uploadedfile import UploadedFile from django.core.files.uploadedfile import UploadedFile
from django.test.utils import override_settings from django.test.utils import override_settings
from edxval.api import create_profile, create_video, get_video_info, get_course_video_image_url from edxval.api import (
create_or_update_transcript_preferences,
create_profile,
create_video,
get_course_video_image_url,
get_transcript_preferences,
get_video_info
)
from mock import Mock, patch from mock import Mock, patch
from contentstore.models import VideoUploadConfig from contentstore.models import VideoUploadConfig
from contentstore.tests.utils import CourseTestCase from contentstore.tests.utils import CourseTestCase
from contentstore.utils import reverse_course_url from contentstore.utils import reverse_course_url
from contentstore.views.videos import ( from contentstore.views.videos import (
_get_default_video_image_url, KEY_EXPIRATION_IN_SECONDS,
validate_video_image,
VIDEO_IMAGE_UPLOAD_ENABLED, VIDEO_IMAGE_UPLOAD_ENABLED,
WAFFLE_SWITCHES, WAFFLE_SWITCHES,
TranscriptProvider StatusDisplayStrings,
TranscriptProvider,
_get_default_video_image_url,
convert_video_status,
validate_video_image
) )
from contentstore.views.videos import KEY_EXPIRATION_IN_SECONDS, StatusDisplayStrings, convert_video_status
from xmodule.modulestore.tests.factories import CourseFactory
from openedx.core.djangoapps.profile_images.tests.helpers import make_image_file from openedx.core.djangoapps.profile_images.tests.helpers import make_image_file
from edxval.api import create_or_update_transcript_preferences, get_transcript_preferences from xmodule.modulestore.tests.factories import CourseFactory
def override_switch(switch, active): def override_switch(switch, active):
......
...@@ -5,18 +5,14 @@ from django.contrib.auth.decorators import login_required ...@@ -5,18 +5,14 @@ from django.contrib.auth.decorators import login_required
from django.http import HttpResponseNotFound from django.http import HttpResponseNotFound
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from django.views.decorators.http import require_POST from django.views.decorators.http import require_POST
from edxval.api import ( from edxval.api import get_3rd_party_transcription_plans, update_transcript_credentials_state_for_org
get_3rd_party_transcription_plans,
update_transcript_credentials_state_for_org,
)
from opaque_keys.edx.keys import CourseKey from opaque_keys.edx.keys import CourseKey
from contentstore.views.videos import TranscriptProvider
from openedx.core.djangoapps.video_config.models import VideoTranscriptEnabledFlag from openedx.core.djangoapps.video_config.models import VideoTranscriptEnabledFlag
from openedx.core.djangoapps.video_pipeline.api import update_3rd_party_transcription_service_credentials from openedx.core.djangoapps.video_pipeline.api import update_3rd_party_transcription_service_credentials
from util.json_request import JsonResponse, expect_json from util.json_request import JsonResponse, expect_json
from contentstore.views.videos import TranscriptProvider
__all__ = ['transcript_credentials_handler'] __all__ = ['transcript_credentials_handler']
......
...@@ -27,17 +27,17 @@ from xmodule.exceptions import NotFoundError ...@@ -27,17 +27,17 @@ from xmodule.exceptions import NotFoundError
from xmodule.modulestore.django import modulestore from xmodule.modulestore.django import modulestore
from xmodule.modulestore.exceptions import ItemNotFoundError from xmodule.modulestore.exceptions import ItemNotFoundError
from xmodule.video_module.transcripts_utils import ( from xmodule.video_module.transcripts_utils import (
GetTranscriptsFromYouTubeException,
Transcript,
TranscriptsRequestValidationException,
copy_or_rename_transcript, copy_or_rename_transcript,
download_youtube_subs, download_youtube_subs,
GetTranscriptsFromYouTubeException,
get_video_transcript_content,
generate_subs_from_source, generate_subs_from_source,
get_transcripts_from_youtube, get_transcripts_from_youtube,
get_video_transcript_content,
manage_video_subtitles_save, manage_video_subtitles_save,
remove_subs_from_store, remove_subs_from_store,
Transcript, youtube_video_transcript_name
TranscriptsRequestValidationException,
youtube_video_transcript_name,
) )
from xmodule.video_module.transcripts_model_utils import ( from xmodule.video_module.transcripts_model_utils import (
is_val_transcript_feature_enabled_for_course is_val_transcript_feature_enabled_for_course
......
import json
from base64 import b64encode from base64 import b64encode
from datetime import timedelta from datetime import timedelta
from hashlib import sha1 from hashlib import sha1
import json
from contentstore.signals.signals import GRADING_POLICY_CHANGED
from eventtracking import tracker from eventtracking import tracker
from contentstore.signals.signals import GRADING_POLICY_CHANGED
from track.event_transaction_utils import create_new_event_transaction_id from track.event_transaction_utils import create_new_event_transaction_id
from xmodule.modulestore.django import modulestore from xmodule.modulestore.django import modulestore
......
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
URL patterns for Javascript files used to load all of the XModule JS in one wad. URL patterns for Javascript files used to load all of the XModule JS in one wad.
""" """
from django.conf.urls import url from django.conf.urls import url
from pipeline_js.views import xmodule_js_files, requirejs_xmodule
from pipeline_js.views import requirejs_xmodule, xmodule_js_files
urlpatterns = [ urlpatterns = [
url(r'^files\.json$', xmodule_js_files, name='xmodule_js_files'), url(r'^files\.json$', xmodule_js_files, name='xmodule_js_files'),
......
...@@ -5,11 +5,13 @@ from django.conf import settings ...@@ -5,11 +5,13 @@ from django.conf import settings
from django.test.utils import override_settings from django.test.utils import override_settings
from course_modes.tests.factories import CourseModeFactory from course_modes.tests.factories import CourseModeFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from xmodule.partitions.partitions import ( from xmodule.partitions.partitions import (
Group, UserPartition, ENROLLMENT_TRACK_PARTITION_ID, MINIMUM_STATIC_PARTITION_ID ENROLLMENT_TRACK_PARTITION_ID,
MINIMUM_STATIC_PARTITION_ID,
Group,
UserPartition
) )
......
...@@ -3,6 +3,7 @@ from django.conf.urls import include, url ...@@ -3,6 +3,7 @@ from django.conf.urls import include, url
from django.conf.urls.static import static from django.conf.urls.static import static
from django.contrib.admin import autodiscover as django_autodiscover from django.contrib.admin import autodiscover as django_autodiscover
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from ratelimitbackend import admin
import contentstore.views import contentstore.views
import openedx.core.djangoapps.common_views.xblock import openedx.core.djangoapps.common_views.xblock
...@@ -10,7 +11,6 @@ import openedx.core.djangoapps.debug.views ...@@ -10,7 +11,6 @@ import openedx.core.djangoapps.debug.views
import openedx.core.djangoapps.external_auth.views import openedx.core.djangoapps.external_auth.views
import openedx.core.djangoapps.lang_pref.views import openedx.core.djangoapps.lang_pref.views
from cms.djangoapps.contentstore.views.organization import OrganizationListView from cms.djangoapps.contentstore.views.organization import OrganizationListView
from ratelimitbackend import admin
django_autodiscover() django_autodiscover()
admin.site.site_header = _('Studio Administration') admin.site.site_header = _('Studio Administration')
......
# Patch the xml libs before anything else. # Patch the xml libs before anything else. Because this makes imports out-of-order, disable pylint errors.
# pylint: disable=wrong-import-order, wrong-import-position
from safe_lxml import defuse_xml_libs from safe_lxml import defuse_xml_libs
defuse_xml_libs() defuse_xml_libs()
import os
# Disable PyContract contract checking when running as a webserver # Disable PyContract contract checking when running as a webserver
import contracts import contracts
# This application object is used by the development server
# as well as any WSGI server configured to use this file.
from django.core.wsgi import get_wsgi_application
import cms.startup as startup
contracts.disable_all() contracts.disable_all()
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cms.envs.aws") os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cms.envs.aws")
import cms.startup as startup
startup.run() startup.run()
# This application object is used by the development server
# as well as any WSGI server configured to use this file.
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application() application = get_wsgi_application()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment