当前位置: 首页>>代码示例>>Python>>正文


Python XMODULE_FACTORY_LOCK.enable方法代码示例

本文整理汇总了Python中xmodule.modulestore.tests.factories.XMODULE_FACTORY_LOCK.enable方法的典型用法代码示例。如果您正苦于以下问题:Python XMODULE_FACTORY_LOCK.enable方法的具体用法?Python XMODULE_FACTORY_LOCK.enable怎么用?Python XMODULE_FACTORY_LOCK.enable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在xmodule.modulestore.tests.factories.XMODULE_FACTORY_LOCK的用法示例。


在下文中一共展示了XMODULE_FACTORY_LOCK.enable方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setUpClass

# 需要导入模块: from xmodule.modulestore.tests.factories import XMODULE_FACTORY_LOCK [as 别名]
# 或者: from xmodule.modulestore.tests.factories.XMODULE_FACTORY_LOCK import enable [as 别名]
    def setUpClass(cls):
        super(SharedModuleStoreTestCase, cls).setUpClass()

        cls._settings_override = override_settings(MODULESTORE=cls.MODULESTORE)
        cls._settings_override.__enter__()
        XMODULE_FACTORY_LOCK.enable()
        clear_existing_modulestores()
        cls.store = modulestore()
开发者ID:Edraak,项目名称:edx-platform,代码行数:10,代码来源:django_utils.py

示例2: _setUpModuleStore

# 需要导入模块: from xmodule.modulestore.tests.factories import XMODULE_FACTORY_LOCK [as 别名]
# 或者: from xmodule.modulestore.tests.factories.XMODULE_FACTORY_LOCK import enable [as 别名]
 def _setUpModuleStore(cls):  # pylint: disable=invalid-name
     """
     Set up the modulestore for an entire test class.
     """
     cls._settings_override = override_settings(MODULESTORE=cls.MODULESTORE)
     cls._settings_override.__enter__()
     XMODULE_FACTORY_LOCK.enable()
     clear_existing_modulestores()
     cls.store = modulestore()
开发者ID:MR612,项目名称:edx-platform,代码行数:11,代码来源:django_utils.py

示例3: setUp

# 需要导入模块: from xmodule.modulestore.tests.factories import XMODULE_FACTORY_LOCK [as 别名]
# 或者: from xmodule.modulestore.tests.factories.XMODULE_FACTORY_LOCK import enable [as 别名]
    def setUp(self, **kwargs):
        """
        Creates a test User if `create_user` is True.
        Returns the password for the test User.

        Args:
            create_user - specifies whether or not to create a test User.  Default is True.
        """
        settings_override = override_settings(MODULESTORE=self.MODULESTORE)
        settings_override.__enter__()
        self.addCleanup(settings_override.__exit__, None, None, None)

        # Clear out any existing modulestores,
        # which will cause them to be re-created
        clear_existing_modulestores()

        self.addCleanup(drop_mongo_collections)
        self.addCleanup(clear_all_caches)

        # Enable XModuleFactories for the space of this test (and its setUp).
        self.addCleanup(XMODULE_FACTORY_LOCK.disable)
        XMODULE_FACTORY_LOCK.enable()

        # When testing CCX, we should make sure that
        # OverrideFieldData.provider_classes is always reset to `None` so
        # that they're recalculated for every test
        OverrideFieldData.provider_classes = None

        super(ModuleStoreTestCase, self).setUp()

        SignalHandler.course_published.disconnect(trigger_update_xblocks_cache_task)

        self.store = modulestore()

        uname = 'testuser'
        email = '[email protected]'
        password = 'foo'

        if kwargs.pop('create_user', True):
            # Create the user so we can log them in.
            self.user = User.objects.create_user(uname, email, password)

            # Note that we do not actually need to do anything
            # for registration if we directly mark them active.
            self.user.is_active = True

            # Staff has access to view all courses
            self.user.is_staff = True
            self.user.save()

        return password
开发者ID:MR612,项目名称:edx-platform,代码行数:53,代码来源:django_utils.py

示例4: start_modulestore_isolation

# 需要导入模块: from xmodule.modulestore.tests.factories import XMODULE_FACTORY_LOCK [as 别名]
# 或者: from xmodule.modulestore.tests.factories.XMODULE_FACTORY_LOCK import enable [as 别名]
    def start_modulestore_isolation(cls):
        """
        Isolate uses of the modulestore after this call. Once
        :py:meth:`end_modulestore_isolation` is called, this modulestore will
        be flushed (all content will be deleted).
        """
        cls.start_cache_isolation()
        override = override_settings(
            MODULESTORE=cls.MODULESTORE,
        )

        cls.__old_modulestores.append(copy.deepcopy(settings.MODULESTORE))
        override.__enter__()
        cls.__settings_overrides.append(override)
        XMODULE_FACTORY_LOCK.enable()
        clear_existing_modulestores()
        cls.store = modulestore()
开发者ID:10clouds,项目名称:edx-platform,代码行数:19,代码来源:django_utils.py

示例5: setUp

# 需要导入模块: from xmodule.modulestore.tests.factories import XMODULE_FACTORY_LOCK [as 别名]
# 或者: from xmodule.modulestore.tests.factories.XMODULE_FACTORY_LOCK import enable [as 别名]
    def setUp(self, **kwargs):
        """
        Creates a test User if `create_user` is True.
        Returns the password for the test User.

        Args:
            create_user - specifies whether or not to create a test User.  Default is True.
        """
        settings_override = override_settings(MODULESTORE=self.MODULESTORE)
        settings_override.__enter__()
        self.addCleanup(settings_override.__exit__, None, None, None)

        # Clear out any existing modulestores,
        # which will cause them to be re-created
        clear_existing_modulestores()

        self.addCleanup(self.drop_mongo_collections)

        self.addCleanup(RequestCache().clear_request_cache)

        # Enable XModuleFactories for the space of this test (and its setUp).
        self.addCleanup(XMODULE_FACTORY_LOCK.disable)
        XMODULE_FACTORY_LOCK.enable()

        super(ModuleStoreTestCase, self).setUp()

        self.store = modulestore()

        uname = 'testuser'
        email = '[email protected]'
        password = 'foo'

        if kwargs.pop('create_user', True):
            # Create the user so we can log them in.
            self.user = User.objects.create_user(uname, email, password)

            # Note that we do not actually need to do anything
            # for registration if we directly mark them active.
            self.user.is_active = True

            # Staff has access to view all courses
            self.user.is_staff = True
            self.user.save()

        return password
开发者ID:mrgnr,项目名称:edx-platform,代码行数:47,代码来源:django_utils.py

示例6: start_modulestore_isolation

# 需要导入模块: from xmodule.modulestore.tests.factories import XMODULE_FACTORY_LOCK [as 别名]
# 或者: from xmodule.modulestore.tests.factories.XMODULE_FACTORY_LOCK import enable [as 别名]
    def start_modulestore_isolation(cls):
        """
        Isolate uses of the modulestore after this call. Once
        :py:meth:`end_modulestore_isolation` is called, this modulestore will
        be flushed (all content will be deleted).
        """
        cls.disable_all_signals()
        cls.enable_signals_by_name(*cls.ENABLED_SIGNALS)
        cls.start_cache_isolation()
        override = override_settings(
            MODULESTORE=cls.MODULESTORE(),
            CONTENTSTORE=cls.CONTENTSTORE(),
        )

        cls.__old_modulestores.append(copy.deepcopy(settings.MODULESTORE))
        cls.__old_contentstores.append(copy.deepcopy(settings.CONTENTSTORE))
        override.__enter__()
        cls.__settings_overrides.append(override)
        XMODULE_FACTORY_LOCK.enable()
        clear_existing_modulestores()
        cls.store = modulestore()
开发者ID:mitocw,项目名称:edx-platform,代码行数:23,代码来源:django_utils.py

示例7: handle

# 需要导入模块: from xmodule.modulestore.tests.factories import XMODULE_FACTORY_LOCK [as 别名]
# 或者: from xmodule.modulestore.tests.factories.XMODULE_FACTORY_LOCK import enable [as 别名]
    def handle(self, *args, **options):
        courses = modulestore().get_courses()

        # Find the largest auto-generated course, and pick the next sequence id to generate the next
        # course with.
        max_org_sequence_id = max([0] + [int(course.org[4:]) for course in courses if course.org.startswith('org.')])

        XMODULE_FACTORY_LOCK.enable()
        CourseFactory.reset_sequence(max_org_sequence_id + 1, force=True)
        course = CourseFactory.create(
            start=datetime.datetime.today() - datetime.timedelta(days=30),
            end=datetime.datetime.today() + datetime.timedelta(days=30),
            number=factory.Sequence('schedules_test_course_{}'.format),
            display_name=factory.Sequence(u'Schedules Test Course {}'.format),
        )
        XMODULE_FACTORY_LOCK.disable()
        course_overview = CourseOverview.load_from_module_store(course.id)
        CourseModeFactory.create(course_id=course_overview.id, mode_slug=CourseMode.AUDIT)
        CourseModeFactory.create(course_id=course_overview.id, mode_slug=CourseMode.VERIFIED)
        CourseDurationLimitExpirySchedule.create_batch(20, enrollment__course=course_overview)

        ScheduleConfigFactory.create(site=Site.objects.get(name='example.com'))
开发者ID:jolyonb,项目名称:edx-platform,代码行数:24,代码来源:cdl_setup_models_to_send_test_emails.py

示例8: handle

# 需要导入模块: from xmodule.modulestore.tests.factories import XMODULE_FACTORY_LOCK [as 别名]
# 或者: from xmodule.modulestore.tests.factories.XMODULE_FACTORY_LOCK import enable [as 别名]
    def handle(self, *args, **options):
        courses = modulestore().get_courses()

        # Find the largest auto-generated course, and pick the next sequence id to generate the next
        # course with.
        max_org_sequence_id = max(int(course.org[4:]) for course in courses if course.org.startswith('org.'))

        XMODULE_FACTORY_LOCK.enable()
        CourseFactory.reset_sequence(max_org_sequence_id + 1, force=True)
        course = CourseFactory.create(
            start=datetime.datetime.today() - datetime.timedelta(days=30),
            end=datetime.datetime.today() + datetime.timedelta(days=30),
            number=factory.Sequence('schedules_test_course_{}'.format),
            display_name=factory.Sequence('Schedules Test Course {}'.format),
        )
        XMODULE_FACTORY_LOCK.disable()
        course_overview = CourseOverview.load_from_module_store(course.id)
        ThreeDayNudgeSchedule.create(enrollment__course=course_overview)
        TenDayNudgeSchedule.create(enrollment__course=course_overview)
        UpgradeReminderSchedule.create(enrollment__course=course_overview)
        ContentHighlightSchedule.create(enrollment__course=course_overview)

        ScheduleConfigFactory.create(site=Site.objects.get(name='example.com'))
开发者ID:cmscom,项目名称:edx-platform,代码行数:25,代码来源:setup_models_to_send_test_emails.py


注:本文中的xmodule.modulestore.tests.factories.XMODULE_FACTORY_LOCK.enable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。