本文整理汇总了Python中xmodule.modulestore.django.clear_existing_modulestores函数的典型用法代码示例。如果您正苦于以下问题:Python clear_existing_modulestores函数的具体用法?Python clear_existing_modulestores怎么用?Python clear_existing_modulestores使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了clear_existing_modulestores函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: setUpClass
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,代码行数:8,代码来源:django_utils.py
示例2: clear_courses
def clear_courses():
# Flush and initialize the module store
# Note that if your test module gets in some weird state
# (though it shouldn't), do this manually
# from the bash shell to drop it:
# $ mongo test_xmodule --eval "db.dropDatabase()"
modulestore()._drop_database() # pylint: disable=protected-access
_CONTENTSTORE.clear()
clear_existing_modulestores()
开发者ID:189140879,项目名称:edx-platform,代码行数:9,代码来源:course_helpers.py
示例3: _setUpModuleStore
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,代码行数:9,代码来源:django_utils.py
示例4: setUpClass
def setUpClass(cls):
"""
Delete the existing modulestores, causing them to be reloaded.
"""
# Clear out any existing modulestores,
# which will cause them to be re-created
# the next time they are accessed.
clear_existing_modulestores()
TestCase.setUpClass()
开发者ID:Bachmann1234,项目名称:edx-platform,代码行数:9,代码来源:django_utils.py
示例5: setUp
def setUp(self):
# Clear out the modulestores, causing them to reload
clear_existing_modulestores()
self.graded_course = modulestore().get_course(SlashSeparatedCourseKey("edX", "graded", "2012_Fall"))
# Create staff account
self.staff = StaffFactory(course_key=self.graded_course.id)
self.logout()
# self.staff.password is the sha hash but login takes the plain text
self.login(self.staff.email, 'test')
self.enroll(self.graded_course)
开发者ID:DNFcode,项目名称:edx-platform,代码行数:12,代码来源:test_masquerade.py
示例6: _post_teardown
def _post_teardown(self):
"""
Flush the ModuleStore after each test.
"""
self.drop_mongo_collections()
# Clear out the existing modulestores,
# which will cause them to be re-created
# the next time they are accessed.
# We do this at *both* setup and teardown just to be safe.
clear_existing_modulestores()
# Call superclass implementation
super(ModuleStoreTestCase, self)._post_teardown()
开发者ID:AdityaKashyap,项目名称:edx-platform,代码行数:13,代码来源:django_utils.py
示例7: setUp
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,代码行数:51,代码来源:django_utils.py
示例8: tearDownClass
def tearDownClass(cls):
"""
Drop the existing modulestores, causing them to be reloaded.
Clean up any data stored in Mongo.
"""
# Clean up by flushing the Mongo modulestore
cls.drop_mongo_collections()
# Clear out the existing modulestores,
# which will cause them to be re-created
# the next time they are accessed.
# We do this at *both* setup and teardown just to be safe.
clear_existing_modulestores()
TestCase.tearDownClass()
开发者ID:Bachmann1234,项目名称:edx-platform,代码行数:15,代码来源:django_utils.py
示例9: start_modulestore_isolation
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,代码行数:17,代码来源:django_utils.py
示例10: setUp
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,代码行数:45,代码来源:django_utils.py
示例11: setUp
def setUp(self):
clear_existing_modulestores()
self.toy = modulestore().get_course(SlashSeparatedCourseKey("edX", "toy", "2012_Fall"))
# Create two accounts
self.student = '[email protected]'
self.instructor = '[email protected]'
self.password = 'foo'
self.create_account('u1', self.student, self.password)
self.create_account('u2', self.instructor, self.password)
self.activate_user(self.student)
self.activate_user(self.instructor)
CourseStaffRole(self.toy.id).add_users(User.objects.get(email=self.instructor))
self.logout()
self.login(self.instructor, self.password)
self.enroll(self.toy)
开发者ID:bmcdonald2,项目名称:edx-platform,代码行数:18,代码来源:test_legacy_anon_csv.py
示例12: setUp
def setUp(self):
clear_existing_modulestores()
courses = modulestore().get_courses()
self.course_id = "edX/toy/2012_Fall"
self.toy = modulestore().get_course(self.course_id)
# Create two accounts
self.student = '[email protected]'
self.instructor = '[email protected]'
self.password = 'foo'
self.create_account('u1', self.student, self.password)
self.create_account('u2', self.instructor, self.password)
self.activate_user(self.student)
self.activate_user(self.instructor)
CourseStaffRole(self.toy.location).add_users(User.objects.get(email=self.instructor))
self.logout()
self.login(self.instructor, self.password)
self.enroll(self.toy)
开发者ID:BeiLuoShiMen,项目名称:edx-platform,代码行数:21,代码来源:test_legacy_forum_admin.py
示例13: setUp
def setUp(self):
# Clear out the modulestores, causing them to reload
clear_existing_modulestores()
self.graded_course = modulestore().get_course("edX/graded/2012_Fall")
# Create staff account
self.instructor = '[email protected]'
self.password = 'foo'
self.create_account('u2', self.instructor, self.password)
self.activate_user(self.instructor)
def make_instructor(course):
CourseStaffRole(course.location).add_users(User.objects.get(email=self.instructor))
make_instructor(self.graded_course)
self.logout()
self.login(self.instructor, self.password)
self.enroll(self.graded_course)
开发者ID:DazzaGreenwood,项目名称:edx-platform,代码行数:21,代码来源:test_masquerade.py
示例14: start_modulestore_isolation
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,代码行数:21,代码来源:django_utils.py
示例15: setUp
def setUp(self):
clear_existing_modulestores()
self.toy = modulestore().get_course("edX/toy/2012_Fall")
# Create two accounts
self.student = '[email protected]'
self.instructor = '[email protected]'
self.password = 'foo'
self.create_account('u1', self.student, self.password)
self.create_account('u2', self.instructor, self.password)
self.activate_user(self.student)
self.activate_user(self.instructor)
def make_instructor(course):
""" Create an instructor for the course. """
group_name = _course_staff_group_name(course.location)
group = Group.objects.create(name=group_name)
group.user_set.add(User.objects.get(email=self.instructor))
make_instructor(self.toy)
self.logout()
self.login(self.instructor, self.password)
self.enroll(self.toy)
开发者ID:AzizYosofi,项目名称:edx-platform,代码行数:24,代码来源:test_legacy_download_csv.py
示例16: setUp
def setUp(self):
"""
Make sure that course is reloaded every time--clear out the modulestore.
"""
clear_existing_modulestores()
开发者ID:6thfdwp,项目名称:edx-platform,代码行数:5,代码来源:tests.py
示例17: setUp
def setUp(self):
clear_existing_modulestores() # redundant w/ cleanup but someone was getting errors
self.addCleanup(ModuleStoreTestCase.drop_mongo_collections, ModuleStoreEnum.Type.split)
self.addCleanup(clear_existing_modulestores)
self.split_store = modulestore()._get_modulestore_by_type(ModuleStoreEnum.Type.split)
开发者ID:LEONOB2014,项目名称:edx-platform,代码行数:5,代码来源:test_crud.py
示例18: setUp
def setUp(self):
"""
Make sure that course is reloaded every time--clear out the modulestore.
"""
clear_existing_modulestores()
self.toy_course_key = SlashSeparatedCourseKey("edX", "toy", "2012_Fall")
开发者ID:gnowledge,项目名称:edx-platform,代码行数:6,代码来源:test_cohorts.py
示例19: setUp
def setUp(self):
clear_existing_modulestores()
开发者ID:ndiayesamba,项目名称:edx-platform,代码行数:2,代码来源:test_crud.py
示例20: setUp
def setUp(self):
super(TemplateTests, self).setUp()
clear_existing_modulestores() # redundant w/ cleanup but someone was getting errors
self.addCleanup(self._drop_mongo_collections)
self.addCleanup(clear_existing_modulestores)
self.split_store = modulestore()._get_modulestore_by_type(ModuleStoreEnum.Type.split)
开发者ID:189140879,项目名称:edx-platform,代码行数:6,代码来源:test_crud.py
注:本文中的xmodule.modulestore.django.clear_existing_modulestores函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论