from student.roles import CourseStaffRole, GlobalStaff from courseware.tests.modulestore_config import TEST_DATA_DIR from dashboard.models import CourseImportLog from dashboard.sysadmin import Users from dashboard.git_import import GitImportError from external_auth.models import ExternalAuthMap from student.tests.factories import UserFactory from xmodule.modulestore.django import modulestore from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.xml import XMLModuleStore from opaque_keys.edx.locations import SlashSeparatedCourseKey from xmodule.modulestore.tests.mongo_connection import MONGO_PORT_NUM, MONGO_HOST from xmodule.modulestore.tests.django_utils import xml_store_config TEST_DATA_XML_MODULESTORE = xml_store_config(TEST_DATA_DIR, ['empty']) TEST_MONGODB_LOG = { 'host': MONGO_HOST, 'port': MONGO_PORT_NUM, 'user': '', 'password': '', 'db': 'test_xlog', } FEATURES_WITH_SSL_AUTH = settings.FEATURES.copy() FEATURES_WITH_SSL_AUTH['AUTH_USE_CERTIFICATES'] = True class SysadminBaseTestCase(ModuleStoreTestCase): """
from student.roles import CourseStaffRole, GlobalStaff from courseware.tests.modulestore_config import TEST_DATA_DIR from dashboard.models import CourseImportLog from dashboard.sysadmin import Users from dashboard.git_import import GitImportError from external_auth.models import ExternalAuthMap from student.tests.factories import UserFactory from xmodule.modulestore.django import modulestore from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.xml import XMLModuleStore from opaque_keys.edx.locations import SlashSeparatedCourseKey from xmodule.modulestore.tests.mongo_connection import MONGO_PORT_NUM, MONGO_HOST from xmodule.modulestore.tests.django_utils import xml_store_config TEST_DATA_XML_MODULESTORE = xml_store_config(TEST_DATA_DIR, ['empty']) TEST_MONGODB_LOG = { 'host': MONGO_HOST, 'port': MONGO_PORT_NUM, 'user': '', 'password': '', 'db': 'test_xlog', } FEATURES_WITH_SSL_AUTH = settings.FEATURES.copy() FEATURES_WITH_SSL_AUTH['AUTH_USE_CERTIFICATES'] = True class SysadminBaseTestCase(ModuleStoreTestCase):
""" Define test configuration for modulestores. """ from xmodule.modulestore.tests.django_utils import xml_store_config, \ mongo_store_config, draft_mongo_store_config,\ mixed_store_config from django.conf import settings TEST_DATA_DIR = settings.COMMON_TEST_DATA_ROOT TEST_DATA_XML_MODULESTORE = xml_store_config(TEST_DATA_DIR) TEST_DATA_MONGO_MODULESTORE = mongo_store_config(TEST_DATA_DIR) TEST_DATA_DRAFT_MONGO_MODULESTORE = draft_mongo_store_config(TEST_DATA_DIR) # Map all XML course fixtures so they are accessible through # the MixedModuleStore MAPPINGS = { 'edX/toy/2012_Fall': 'xml', 'edX/toy/TT_2012_Fall': 'xml', 'edX/test_end/2012_Fall': 'xml', 'edX/test_about_blob_end_date/2012_Fall': 'xml', 'edX/graded/2012_Fall': 'xml', 'edX/open_ended/2012_Fall': 'xml', } TEST_DATA_MIXED_MODULESTORE = mixed_store_config(TEST_DATA_DIR, MAPPINGS)
TEST_COURSE_NAME = 'test_course' TEST_COURSE_NUMBER = '1.23x' from instructor_task.models import ReportStore from student.models import CourseEnrollment from xmodule.partitions.partitions import Group, UserPartition from openedx.core.djangoapps.course_groups.models import CourseUserGroupPartitionGroup from openedx.core.djangoapps.course_groups.tests.helpers import CohortFactory import openedx.core.djangoapps.user_api.course_tag.api as course_tag_api from openedx.core.djangoapps.user_api.partition_schemes import RandomUserPartitionScheme from instructor_task.models import ReportStore from instructor_task.tests.test_base import InstructorTaskCourseTestCase, TestReportMixin from django.conf import settings TEST_DATA_DIR = settings.COMMON_TEST_DATA_ROOT TEST_DATA_XML_MODULESTORE = xml_store_config(TEST_DATA_DIR, source_dirs=['unicode_graded']) @ddt.ddt class TestInstructorGradeReport(TestReportMixin, InstructorTaskCourseTestCase): """ Tests that CSV grade report generation works. """ def setUp(self): super(TestInstructorGradeReport, self).setUp() self.course = CourseFactory.create() @ddt.data([u'*****@*****.**', u'ni\[email protected]']) def test_unicode_emails(self, emails): """ Test that students with unicode characters in emails is handled.