The existing pattern of using `override_settings(MODULESTORE=...)` prevented us from having more than one layer of subclassing in modulestore tests. In a structure like: @override_settings(MODULESTORE=store_a) class BaseTestCase(ModuleStoreTestCase): def setUp(self): # use store @override_settings(MODULESTORE=store_b) class ChildTestCase(BaseTestCase): def setUp(self): # use store In this case, the store actions performed in `BaseTestCase` on behalf of `ChildTestCase` would still use `store_a`, even though the `ChildTestCase` had specified to use `store_b`. This is because the `override_settings` decorator would be the innermost wrapper around the `BaseTestCase.setUp` method, no matter what `ChildTestCase` does. To remedy this, we move the call to `override_settings` into the `ModuleStoreTestCase.setUp` method, and use a cleanup to remove the override. Subclasses can just defined the `MODULESTORE` class attribute to specify which modulestore to use _for the entire `setUp` chain_. [PLAT-419]
Name |
Last commit
|
Last update |
---|---|---|
.. | ||
__init__.py | Loading commit data... | |
factories.py | Loading commit data... | |
helpers.py | Loading commit data... | |
test_about.py | Loading commit data... | |
test_access.py | Loading commit data... | |
test_course_info.py | Loading commit data... | |
test_course_survey.py | Loading commit data... | |
test_courses.py | Loading commit data... | |
test_draft_modulestore.py | Loading commit data... | |
test_entrance_exam.py | Loading commit data... | |
test_favicon.py | Loading commit data... | |
test_footer.py | Loading commit data... | |
test_grades.py | Loading commit data... | |
test_group_access.py | Loading commit data... | |
test_i18n.py | Loading commit data... | |
test_lti_integration.py | Loading commit data... | |
test_masquerade.py | Loading commit data... | |
test_microsites.py | Loading commit data... | |
test_middleware.py | Loading commit data... | |
test_model_data.py | Loading commit data... | |
test_module_render.py | Loading commit data... | |
test_navigation.py | Loading commit data... | |
test_password_history.py | Loading commit data... | |
test_recommender.py | Loading commit data... | |
test_split_module.py | Loading commit data... | |
test_submitting_problems.py | Loading commit data... | |
test_tabs.py | Loading commit data... | |
test_video_handlers.py | Loading commit data... | |
test_video_mongo.py | Loading commit data... | |
test_video_xml.py | Loading commit data... | |
test_view_authentication.py | Loading commit data... | |
test_views.py | Loading commit data... | |
test_word_cloud.py | Loading commit data... | |
tests.py | Loading commit data... |