Commit 8165a033 by Will Daly

Pep8/pylint fixes

Fixed test_masquerade failure due to not clearing the modulestore
between tests.
parent 109d3c3d
......@@ -17,7 +17,7 @@ from xmodule.modulestore.tests.django_utils import mixed_store_config
# cms.envs.test doesn't.
TEST_DATA_DIR = settings.COMMON_TEST_DATA_ROOT
TEST_MAPPING = { 'edX/toy/2012_Fall': 'xml' }
TEST_MAPPING = {'edX/toy/2012_Fall': 'xml'}
TEST_DATA_MIXED_MODULESTORE = mixed_store_config(TEST_DATA_DIR, TEST_MAPPING)
......
......@@ -18,7 +18,7 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.inheritance import own_metadata
from xmodule.modulestore.django import editable_modulestore
from courseware.tests.tests import TEST_DATA_MIXED_MODULESTORE
from courseware.tests.modulestore_config import TEST_DATA_MIXED_MODULESTORE
from external_auth.models import ExternalAuthMap
from external_auth.views import shib_login, course_specific_login, course_specific_register
......
......@@ -103,10 +103,9 @@ def editable_modulestore(name='default'):
store = store.modulestores['default']
# At this point, we either have the ability to create
# items in the store, or we do not.
# items in the store, or we do not.
if hasattr(store, 'create_xmodule'):
return store
else:
return None
......@@ -5,8 +5,7 @@ Modulestore configuration for test cases.
from uuid import uuid4
from django.test import TestCase
from xmodule.modulestore.django import editable_modulestore, \
editable_modulestore, clear_existing_modulestores
from unittest.util import safe_repr
clear_existing_modulestores
def mixed_store_config(data_dir, mappings):
......
"""
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
mongo_store_config, draft_mongo_store_config,\
mixed_store_config
from django.conf import settings
......
......@@ -16,17 +16,22 @@ from django.contrib.auth.models import Group, User
from courseware.access import _course_staff_group_name
from courseware.tests.helpers import LoginEnrollmentTestCase
from courseware.tests.modulestore_config import TEST_DATA_MIXED_MODULESTORE
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.django import modulestore, clear_existing_modulestores
import json
@override_settings(MODULESTORE=TEST_DATA_MIXED_MODULESTORE)
class TestStaffMasqueradeAsStudent(LoginEnrollmentTestCase):
class TestStaffMasqueradeAsStudent(ModuleStoreTestCase, LoginEnrollmentTestCase):
"""
Check for staff being able to masquerade as student.
"""
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
......
......@@ -64,9 +64,9 @@ class PageLoaderTestCase(LoginEnrollmentTestCase):
)
items = store.get_items(
location_query,
course_id=course_id,
depth=2
location_query,
course_id=course_id,
depth=2
)
if len(items) < 1:
......
......@@ -85,6 +85,7 @@ class TestInstructorAccessAllow(ModuleStoreTestCase):
group = Group.objects.get(name=get_access_group_name(self.course, 'staff'))
self.assertIn(user, group.user_set.all())
@override_settings(MODULESTORE=TEST_DATA_MIXED_MODULESTORE)
class TestInstructorAccessRevoke(ModuleStoreTestCase):
""" Test access revoke. """
......
......@@ -14,6 +14,7 @@ from xmodule.modulestore.tests.factories import CourseFactory
from instructor.views import legacy
@override_settings(MODULESTORE=TEST_DATA_MIXED_MODULESTORE)
class TestXss(ModuleStoreTestCase):
def setUp(self):
......
......@@ -36,6 +36,7 @@ HTML_BOOK = {
],
}
@override_settings(MODULESTORE=TEST_DATA_MIXED_MODULESTORE)
class StaticBookTest(ModuleStoreTestCase):
"""
......
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