Commit 03a05fd9 by Calen Pennington

Always call super(..).setUp() from setUp

parent b1dfac56
...@@ -22,6 +22,8 @@ class ExportAllCourses(ModuleStoreTestCase): ...@@ -22,6 +22,8 @@ class ExportAllCourses(ModuleStoreTestCase):
""" """
def setUp(self): def setUp(self):
""" Common setup. """ """ Common setup. """
super(ExportAllCourses, self).setUp()
self.content_store = contentstore() self.content_store = contentstore()
self.module_store = modulestore() self.module_store = modulestore()
......
...@@ -16,6 +16,8 @@ class TestArgParsing(unittest.TestCase): ...@@ -16,6 +16,8 @@ class TestArgParsing(unittest.TestCase):
Tests for parsing arguments for the `create_course` management command Tests for parsing arguments for the `create_course` management command
""" """
def setUp(self): def setUp(self):
super(TestArgParsing, self).setUp()
self.command = Command() self.command = Command()
def test_no_args(self): def test_no_args(self):
......
...@@ -18,6 +18,7 @@ class ExportAllCourses(ModuleStoreTestCase): ...@@ -18,6 +18,7 @@ class ExportAllCourses(ModuleStoreTestCase):
""" """
def setUp(self): def setUp(self):
""" Common setup. """ """ Common setup. """
super(ExportAllCourses, self).setUp()
self.store = modulestore()._get_modulestore_by_type(ModuleStoreEnum.Type.mongo) self.store = modulestore()._get_modulestore_by_type(ModuleStoreEnum.Type.mongo)
self.temp_dir = mkdtemp() self.temp_dir = mkdtemp()
self.first_course = CourseFactory.create(org="test", course="course1", display_name="run1") self.first_course = CourseFactory.create(org="test", course="course1", display_name="run1")
......
...@@ -16,6 +16,8 @@ class ConvertExportFormat(TestCase): ...@@ -16,6 +16,8 @@ class ConvertExportFormat(TestCase):
""" """
def setUp(self): def setUp(self):
""" Common setup. """ """ Common setup. """
super(ConvertExportFormat, self).setUp()
self.temp_dir = mkdtemp() self.temp_dir = mkdtemp()
self.data_dir = path(__file__).realpath().parent / 'data' self.data_dir = path(__file__).realpath().parent / 'data'
self.version0 = self.data_dir / "Version0_drafts.tar.gz" self.version0 = self.data_dir / "Version0_drafts.tar.gz"
......
...@@ -1747,6 +1747,7 @@ class EntryPageTestCase(TestCase): ...@@ -1747,6 +1747,7 @@ class EntryPageTestCase(TestCase):
Tests entry pages that aren't specific to a course. Tests entry pages that aren't specific to a course.
""" """
def setUp(self): def setUp(self):
super(EntryPageTestCase, self).setUp()
self.client = AjaxEnabledTestClient() self.client = AjaxEnabledTestClient()
def _test_page(self, page, status_code=200): def _test_page(self, page, status_code=200):
......
...@@ -20,6 +20,7 @@ class TemplateTests(unittest.TestCase): ...@@ -20,6 +20,7 @@ class TemplateTests(unittest.TestCase):
""" """
def setUp(self): def setUp(self):
super(TemplateTests, self).setUp()
clear_existing_modulestores() # redundant w/ cleanup but someone was getting errors clear_existing_modulestores() # redundant w/ cleanup but someone was getting errors
self.addCleanup(self._drop_mongo_collections) self.addCleanup(self._drop_mongo_collections)
self.addCleanup(clear_existing_modulestores) self.addCleanup(clear_existing_modulestores)
......
...@@ -19,6 +19,8 @@ class InternationalizationTest(ModuleStoreTestCase): ...@@ -19,6 +19,8 @@ class InternationalizationTest(ModuleStoreTestCase):
will be cleared out before each test case execution and deleted will be cleared out before each test case execution and deleted
afterwards. afterwards.
""" """
super(InternationalizationTest, self).setUp(create_user=False)
self.uname = 'testuser' self.uname = 'testuser'
self.email = 'test+courses@edx.org' self.email = 'test+courses@edx.org'
self.password = 'foo' self.password = 'foo'
......
...@@ -28,6 +28,8 @@ TEST_DATA_CONTENTSTORE['DOC_STORE_CONFIG']['db'] = 'test_xcontent_%s' % uuid4(). ...@@ -28,6 +28,8 @@ TEST_DATA_CONTENTSTORE['DOC_STORE_CONFIG']['db'] = 'test_xcontent_%s' % uuid4().
class TestGenerateSubs(unittest.TestCase): class TestGenerateSubs(unittest.TestCase):
"""Tests for `generate_subs` function.""" """Tests for `generate_subs` function."""
def setUp(self): def setUp(self):
super(TestGenerateSubs, self).setUp()
self.source_subs = { self.source_subs = {
'start': [100, 200, 240, 390, 1000], 'start': [100, 200, 240, 390, 1000],
'end': [200, 240, 380, 1000, 1500], 'end': [200, 240, 380, 1000, 1500],
...@@ -93,6 +95,7 @@ class TestSaveSubsToStore(ModuleStoreTestCase): ...@@ -93,6 +95,7 @@ class TestSaveSubsToStore(ModuleStoreTestCase):
def setUp(self): def setUp(self):
super(TestSaveSubsToStore, self).setUp()
self.course = CourseFactory.create( self.course = CourseFactory.create(
org=self.org, number=self.number, display_name=self.display_name) org=self.org, number=self.number, display_name=self.display_name)
...@@ -183,6 +186,7 @@ class TestDownloadYoutubeSubs(ModuleStoreTestCase): ...@@ -183,6 +186,7 @@ class TestDownloadYoutubeSubs(ModuleStoreTestCase):
self.clear_sub_content(subs_id) self.clear_sub_content(subs_id)
def setUp(self): def setUp(self):
super(TestDownloadYoutubeSubs, self).setUp()
self.course = CourseFactory.create( self.course = CourseFactory.create(
org=self.org, number=self.number, display_name=self.display_name) org=self.org, number=self.number, display_name=self.display_name)
...@@ -477,6 +481,7 @@ class TestTranscript(unittest.TestCase): ...@@ -477,6 +481,7 @@ class TestTranscript(unittest.TestCase):
Tests for Transcript class e.g. different transcript conversions. Tests for Transcript class e.g. different transcript conversions.
""" """
def setUp(self): def setUp(self):
super(TestTranscript, self).setUp()
self.srt_transcript = textwrap.dedent("""\ self.srt_transcript = textwrap.dedent("""\
0 0
......
...@@ -196,6 +196,8 @@ class XBlockVisibilityTestCase(TestCase): ...@@ -196,6 +196,8 @@ class XBlockVisibilityTestCase(TestCase):
"""Tests for xblock visibility for students.""" """Tests for xblock visibility for students."""
def setUp(self): def setUp(self):
super(XBlockVisibilityTestCase, self).setUp()
self.dummy_user = ModuleStoreEnum.UserID.test self.dummy_user = ModuleStoreEnum.UserID.test
self.past = datetime(1970, 1, 1) self.past = datetime(1970, 1, 1)
self.future = datetime.now(UTC) + timedelta(days=1) self.future = datetime.now(UTC) + timedelta(days=1)
......
...@@ -88,6 +88,8 @@ class AuthTestCase(ContentStoreTestCase): ...@@ -88,6 +88,8 @@ class AuthTestCase(ContentStoreTestCase):
"""Check that various permissions-related things work""" """Check that various permissions-related things work"""
def setUp(self): def setUp(self):
super(AuthTestCase, self).setUp(create_user=False)
self.email = 'a@b.com' self.email = 'a@b.com'
self.pw = 'xyz' self.pw = 'xyz'
self.username = 'testuser' self.username = 'testuser'
......
...@@ -17,6 +17,8 @@ class RolesTest(TestCase): ...@@ -17,6 +17,8 @@ class RolesTest(TestCase):
""" """
def setUp(self): def setUp(self):
""" Test case setup """ """ Test case setup """
super(RolesTest, self).setUp()
self.global_admin = AdminFactory() self.global_admin = AdminFactory()
self.instructor = User.objects.create_user('testinstructor', 'testinstructor+courses@edx.org', 'foo') self.instructor = User.objects.create_user('testinstructor', 'testinstructor+courses@edx.org', 'foo')
self.staff = User.objects.create_user('teststaff', 'teststaff+courses@edx.org', 'foo') self.staff = User.objects.create_user('teststaff', 'teststaff+courses@edx.org', 'foo')
......
...@@ -1188,6 +1188,8 @@ class TestEditSplitModule(ItemTest): ...@@ -1188,6 +1188,8 @@ class TestEditSplitModule(ItemTest):
@ddt.ddt @ddt.ddt
class TestComponentHandler(TestCase): class TestComponentHandler(TestCase):
def setUp(self): def setUp(self):
super(TestComponentHandler, self).setUp()
self.request_factory = RequestFactory() self.request_factory = RequestFactory()
patcher = patch('contentstore.views.component.modulestore') patcher = patch('contentstore.views.component.modulestore')
......
...@@ -292,6 +292,8 @@ class TextbookValidationTestCase(TestCase): ...@@ -292,6 +292,8 @@ class TextbookValidationTestCase(TestCase):
def setUp(self): def setUp(self):
"Set some useful content for tests" "Set some useful content for tests"
super(TextbookValidationTestCase, self).setUp()
self.tb1 = { self.tb1 = {
"tab_title": "Hi, mom!", "tab_title": "Hi, mom!",
"url": "/mom.pdf" "url": "/mom.pdf"
......
...@@ -21,6 +21,7 @@ class EmbargoCourseFormTest(ModuleStoreTestCase): ...@@ -21,6 +21,7 @@ class EmbargoCourseFormTest(ModuleStoreTestCase):
"""Test the course form properly validates course IDs""" """Test the course form properly validates course IDs"""
def setUp(self): def setUp(self):
super(EmbargoCourseFormTest, self).setUp()
self.course = CourseFactory.create() self.course = CourseFactory.create()
self.true_form_data = {'course_id': self.course.id.to_deprecated_string(), 'embargoed': True} self.true_form_data = {'course_id': self.course.id.to_deprecated_string(), 'embargoed': True}
self.false_form_data = {'course_id': self.course.id.to_deprecated_string(), 'embargoed': False} self.false_form_data = {'course_id': self.course.id.to_deprecated_string(), 'embargoed': False}
......
...@@ -37,6 +37,8 @@ class EmbargoMiddlewareTests(ModuleStoreTestCase): ...@@ -37,6 +37,8 @@ class EmbargoMiddlewareTests(ModuleStoreTestCase):
Tests of EmbargoMiddleware Tests of EmbargoMiddleware
""" """
def setUp(self): def setUp(self):
super(EmbargoMiddlewareTests, self).setUp()
self.user = UserFactory(username='fred', password='secret') self.user = UserFactory(username='fred', password='secret')
self.client.login(username='fred', password='secret') self.client.login(username='fred', password='secret')
self.embargo_course = CourseFactory.create() self.embargo_course = CourseFactory.create()
......
...@@ -20,6 +20,7 @@ class CountryMiddlewareTests(TestCase): ...@@ -20,6 +20,7 @@ class CountryMiddlewareTests(TestCase):
Tests of CountryMiddleware. Tests of CountryMiddleware.
""" """
def setUp(self): def setUp(self):
super(CountryMiddlewareTests, self).setUp()
self.country_middleware = CountryMiddleware() self.country_middleware = CountryMiddleware()
self.session_middleware = SessionMiddleware() self.session_middleware = SessionMiddleware()
self.authenticated_user = UserFactory.create() self.authenticated_user = UserFactory.create()
......
...@@ -27,6 +27,8 @@ class TestTransferStudents(ModuleStoreTestCase): ...@@ -27,6 +27,8 @@ class TestTransferStudents(ModuleStoreTestCase):
def setUp(self, **kwargs): def setUp(self, **kwargs):
"""Connect a stub receiver, and analytics event tracking.""" """Connect a stub receiver, and analytics event tracking."""
super(TestTransferStudents, self).setUp()
UNENROLL_DONE.connect(self.assert_unenroll_signal) UNENROLL_DONE.connect(self.assert_unenroll_signal)
patcher = patch('student.models.tracker') patcher = patch('student.models.tracker')
self.mock_tracker = patcher.start() self.mock_tracker = patcher.start()
......
...@@ -31,6 +31,8 @@ class TestStudentDashboardEmailView(ModuleStoreTestCase): ...@@ -31,6 +31,8 @@ class TestStudentDashboardEmailView(ModuleStoreTestCase):
Check for email view displayed with flag Check for email view displayed with flag
""" """
def setUp(self): def setUp(self):
super(TestStudentDashboardEmailView, self).setUp()
self.course = CourseFactory.create() self.course = CourseFactory.create()
# Create student account # Create student account
......
...@@ -50,6 +50,7 @@ class LoginFormTest(UrlResetMixin, ModuleStoreTestCase): ...@@ -50,6 +50,7 @@ class LoginFormTest(UrlResetMixin, ModuleStoreTestCase):
@patch.dict(settings.FEATURES, {"ENABLE_COMBINED_LOGIN_REGISTRATION": False}) @patch.dict(settings.FEATURES, {"ENABLE_COMBINED_LOGIN_REGISTRATION": False})
def setUp(self): def setUp(self):
super(LoginFormTest, self).setUp('lms.urls') super(LoginFormTest, self).setUp('lms.urls')
self.url = reverse("signin_user") self.url = reverse("signin_user")
self.course = CourseFactory.create() self.course = CourseFactory.create()
self.course_id = unicode(self.course.id) self.course_id = unicode(self.course.id)
...@@ -162,6 +163,7 @@ class RegisterFormTest(UrlResetMixin, ModuleStoreTestCase): ...@@ -162,6 +163,7 @@ class RegisterFormTest(UrlResetMixin, ModuleStoreTestCase):
@patch.dict(settings.FEATURES, {"ENABLE_COMBINED_LOGIN_REGISTRATION": False}) @patch.dict(settings.FEATURES, {"ENABLE_COMBINED_LOGIN_REGISTRATION": False})
def setUp(self): def setUp(self):
super(RegisterFormTest, self).setUp('lms.urls') super(RegisterFormTest, self).setUp('lms.urls')
self.url = reverse("register_user") self.url = reverse("register_user")
self.course = CourseFactory.create() self.course = CourseFactory.create()
self.course_id = unicode(self.course.id) self.course_id = unicode(self.course.id)
......
...@@ -18,6 +18,7 @@ class KeywordSubTest(ModuleStoreTestCase): ...@@ -18,6 +18,7 @@ class KeywordSubTest(ModuleStoreTestCase):
""" Tests for the keyword substitution feature """ """ Tests for the keyword substitution feature """
def setUp(self): def setUp(self):
super(KeywordSubTest, self).setUp(create_user=False)
self.user = UserFactory.create( self.user = UserFactory.create(
email="testuser@edx.org", email="testuser@edx.org",
username="testuser", username="testuser",
......
...@@ -13,6 +13,7 @@ class CorrectMapTest(unittest.TestCase): ...@@ -13,6 +13,7 @@ class CorrectMapTest(unittest.TestCase):
""" """
def setUp(self): def setUp(self):
super(CorrectMapTest, self).setUp()
self.cmap = CorrectMap() self.cmap = CorrectMap()
def test_set_input_properties(self): def test_set_input_properties(self):
......
...@@ -34,6 +34,7 @@ class TemplateTestCase(unittest.TestCase): ...@@ -34,6 +34,7 @@ class TemplateTestCase(unittest.TestCase):
""" """
Load the template under test. Load the template under test.
""" """
super(TemplateTestCase, self).setUp()
capa_path = capa.__path__[0] capa_path = capa.__path__[0]
self.template_path = os.path.join(capa_path, self.template_path = os.path.join(capa_path,
'templates', 'templates',
......
...@@ -393,6 +393,7 @@ class MatlabTest(unittest.TestCase): ...@@ -393,6 +393,7 @@ class MatlabTest(unittest.TestCase):
Test Matlab input types Test Matlab input types
''' '''
def setUp(self): def setUp(self):
super(MatlabTest, self).setUp()
self.rows = '10' self.rows = '10'
self.cols = '80' self.cols = '80'
self.tabsize = '4' self.tabsize = '4'
...@@ -1003,6 +1004,7 @@ class ChemicalEquationTest(unittest.TestCase): ...@@ -1003,6 +1004,7 @@ class ChemicalEquationTest(unittest.TestCase):
Check that chemical equation inputs work. Check that chemical equation inputs work.
''' '''
def setUp(self): def setUp(self):
super(ChemicalEquationTest, self).setUp()
self.size = "42" self.size = "42"
xml_str = """<chemicalequationinput id="prob_1_2" size="{size}"/>""".format(size=self.size) xml_str = """<chemicalequationinput id="prob_1_2" size="{size}"/>""".format(size=self.size)
...@@ -1089,6 +1091,7 @@ class FormulaEquationTest(unittest.TestCase): ...@@ -1089,6 +1091,7 @@ class FormulaEquationTest(unittest.TestCase):
Check that formula equation inputs work. Check that formula equation inputs work.
""" """
def setUp(self): def setUp(self):
super(FormulaEquationTest, self).setUp()
self.size = "42" self.size = "42"
xml_str = """<formulaequationinput id="prob_1_2" size="{size}"/>""".format(size=self.size) xml_str = """<formulaequationinput id="prob_1_2" size="{size}"/>""".format(size=self.size)
......
...@@ -37,6 +37,7 @@ class ResponseTest(unittest.TestCase): ...@@ -37,6 +37,7 @@ class ResponseTest(unittest.TestCase):
maxDiff = None maxDiff = None
def setUp(self): def setUp(self):
super(ResponseTest, self).setUp()
if self.xml_factory_class: if self.xml_factory_class:
self.xml_factory = self.xml_factory_class() self.xml_factory = self.xml_factory_class()
......
...@@ -19,6 +19,7 @@ class FormulaTest(unittest.TestCase): ...@@ -19,6 +19,7 @@ class FormulaTest(unittest.TestCase):
mathml_end = '</mstyle></math>' mathml_end = '</mstyle></math>'
def setUp(self): def setUp(self):
super(FormulaTest, self).setUp()
self.formulaInstance = formula.formula('') self.formulaInstance = formula.formula('')
def test_replace_mathvariants(self): def test_replace_mathvariants(self):
......
...@@ -62,6 +62,7 @@ class TestSortedAssetList(unittest.TestCase): ...@@ -62,6 +62,7 @@ class TestSortedAssetList(unittest.TestCase):
Tests the SortedAssetList class. Tests the SortedAssetList class.
""" """
def setUp(self): def setUp(self):
super(TestSortedAssetList, self).setUp()
asset_list = [dict(zip(AssetStoreTestData.asset_fields, asset)) for asset in AssetStoreTestData.all_asset_data] asset_list = [dict(zip(AssetStoreTestData.asset_fields, asset)) for asset in AssetStoreTestData.all_asset_data]
self.sorted_asset_list_by_filename = SortedAssetList(iterable=asset_list) self.sorted_asset_list_by_filename = SortedAssetList(iterable=asset_list)
self.sorted_asset_list_by_last_edit = SortedAssetList(iterable=asset_list, key=lambda x: x['edited_on']) self.sorted_asset_list_by_last_edit = SortedAssetList(iterable=asset_list, key=lambda x: x['edited_on'])
......
...@@ -153,13 +153,9 @@ class TestMongoModuleStoreBase(unittest.TestCase): ...@@ -153,13 +153,9 @@ class TestMongoModuleStoreBase(unittest.TestCase):
# Destroy the test db. # Destroy the test db.
connection.drop_database(DB) connection.drop_database(DB)
@classmethod def setUp(self):
def setUp(cls): super(TestMongoModuleStoreBase, self).setUp()
cls.dummy_user = ModuleStoreEnum.UserID.test self.dummy_user = ModuleStoreEnum.UserID.test
@classmethod
def tearDown(cls):
pass
class TestMongoModuleStore(TestMongoModuleStoreBase): class TestMongoModuleStore(TestMongoModuleStoreBase):
...@@ -742,12 +738,13 @@ class TestMongoModuleStoreWithNoAssetCollection(TestMongoModuleStore): ...@@ -742,12 +738,13 @@ class TestMongoModuleStoreWithNoAssetCollection(TestMongoModuleStore):
self.assertRaises(ItemNotFoundError, lambda: self.draft_store.get_all_asset_metadata(course_key, 'asset')[:1]) self.assertRaises(ItemNotFoundError, lambda: self.draft_store.get_all_asset_metadata(course_key, 'asset')[:1])
class TestMongoKeyValueStore(object): class TestMongoKeyValueStore(unittest.TestCase):
""" """
Tests for MongoKeyValueStore. Tests for MongoKeyValueStore.
""" """
def setUp(self): def setUp(self):
super(TestMongoKeyValueStore, self).setUp()
self.data = {'foo': 'foo_value'} self.data = {'foo': 'foo_value'}
self.course_id = SlashSeparatedCourseKey('org', 'course', 'run') self.course_id = SlashSeparatedCourseKey('org', 'course', 'run')
self.parent = self.course_id.make_usage_key('parent', 'p') self.parent = self.course_id.make_usage_key('parent', 'p')
......
...@@ -519,6 +519,7 @@ class SplitModuleTest(unittest.TestCase): ...@@ -519,6 +519,7 @@ class SplitModuleTest(unittest.TestCase):
split_store.copy("test@edx.org", source_course, destination, [to_publish], None) split_store.copy("test@edx.org", source_course, destination, [to_publish], None)
def setUp(self): def setUp(self):
super(SplitModuleTest, self).setUp()
self.user_id = random.getrandbits(32) self.user_id = random.getrandbits(32)
def tearDown(self): def tearDown(self):
...@@ -1707,7 +1708,7 @@ class TestPublish(SplitModuleTest): ...@@ -1707,7 +1708,7 @@ class TestPublish(SplitModuleTest):
Test the publishing api Test the publishing api
""" """
def setUp(self): def setUp(self):
SplitModuleTest.setUp(self) super(TestPublish, self).setUp()
def tearDown(self): def tearDown(self):
SplitModuleTest.tearDown(self) SplitModuleTest.tearDown(self)
......
...@@ -114,6 +114,7 @@ class PartitionTestCase(TestCase): ...@@ -114,6 +114,7 @@ class PartitionTestCase(TestCase):
TEST_SCHEME_NAME = "mock" TEST_SCHEME_NAME = "mock"
def setUp(self): def setUp(self):
super(PartitionTestCase, self).setUp()
# Set up two user partition schemes: mock and random # Set up two user partition schemes: mock and random
self.non_random_scheme = MockUserPartitionScheme(self.TEST_SCHEME_NAME) self.non_random_scheme = MockUserPartitionScheme(self.TEST_SCHEME_NAME)
self.random_scheme = MockUserPartitionScheme("random") self.random_scheme = MockUserPartitionScheme("random")
......
...@@ -172,9 +172,6 @@ def mock_render_template(*args, **kwargs): ...@@ -172,9 +172,6 @@ def mock_render_template(*args, **kwargs):
class ModelsTest(unittest.TestCase): class ModelsTest(unittest.TestCase):
def setUp(self):
pass
def test_load_class(self): def test_load_class(self):
vc = XModuleDescriptor.load_class('video') vc = XModuleDescriptor.load_class('video')
vc_str = "<class 'xmodule.video_module.video_module.VideoDescriptor'>" vc_str = "<class 'xmodule.video_module.video_module.VideoDescriptor'>"
...@@ -187,6 +184,7 @@ class LogicTest(unittest.TestCase): ...@@ -187,6 +184,7 @@ class LogicTest(unittest.TestCase):
raw_field_data = {} raw_field_data = {}
def setUp(self): def setUp(self):
super(LogicTest, self).setUp()
self.system = get_test_system() self.system = get_test_system()
self.descriptor = Mock(name="descriptor", url_name='', category='test') self.descriptor = Mock(name="descriptor", url_name='', category='test')
......
...@@ -32,6 +32,7 @@ class AnnotatableModuleTestCase(unittest.TestCase): ...@@ -32,6 +32,7 @@ class AnnotatableModuleTestCase(unittest.TestCase):
''' '''
def setUp(self): def setUp(self):
super(AnnotatableModuleTestCase, self).setUp()
self.annotatable = AnnotatableModule( self.annotatable = AnnotatableModule(
Mock(), Mock(),
get_test_system(), get_test_system(),
......
...@@ -187,6 +187,8 @@ if submission[0] == '': ...@@ -187,6 +187,8 @@ if submission[0] == '':
class CapaModuleTest(unittest.TestCase): class CapaModuleTest(unittest.TestCase):
def setUp(self): def setUp(self):
super(CapaModuleTest, self).setUp()
now = datetime.datetime.now(UTC) now = datetime.datetime.now(UTC)
day_delta = datetime.timedelta(days=1) day_delta = datetime.timedelta(days=1)
self.yesterday_str = str(now - day_delta) self.yesterday_str = str(now - day_delta)
...@@ -1736,6 +1738,7 @@ class TestProblemCheckTracking(unittest.TestCase): ...@@ -1736,6 +1738,7 @@ class TestProblemCheckTracking(unittest.TestCase):
""" """
def setUp(self): def setUp(self):
super(TestProblemCheckTracking, self).setUp()
self.maxDiff = None self.maxDiff = None
def test_choice_answer_text(self): def test_choice_answer_text(self):
......
...@@ -85,6 +85,7 @@ class OpenEndedChildTest(unittest.TestCase): ...@@ -85,6 +85,7 @@ class OpenEndedChildTest(unittest.TestCase):
descriptor = Mock() descriptor = Mock()
def setUp(self): def setUp(self):
super(OpenEndedChildTest, self).setUp()
self.test_system = get_test_system() self.test_system = get_test_system()
self.test_system.open_ended_grading_interface = None self.test_system.open_ended_grading_interface = None
self.openendedchild = OpenEndedChild(self.test_system, self.location, self.openendedchild = OpenEndedChild(self.test_system, self.location,
...@@ -249,6 +250,7 @@ class OpenEndedModuleTest(unittest.TestCase): ...@@ -249,6 +250,7 @@ class OpenEndedModuleTest(unittest.TestCase):
} }
def setUp(self): def setUp(self):
super(OpenEndedModuleTest, self).setUp()
self.test_system = get_test_system() self.test_system = get_test_system()
self.test_system.open_ended_grading_interface = None self.test_system.open_ended_grading_interface = None
self.test_system.location = self.location self.test_system.location = self.location
...@@ -529,6 +531,7 @@ class CombinedOpenEndedModuleTest(unittest.TestCase): ...@@ -529,6 +531,7 @@ class CombinedOpenEndedModuleTest(unittest.TestCase):
) )
def setUp(self): def setUp(self):
super(CombinedOpenEndedModuleTest, self).setUp()
self.combinedoe = CombinedOpenEndedV1Module(self.test_system, self.combinedoe = CombinedOpenEndedV1Module(self.test_system,
self.location, self.location,
self.definition, self.definition,
...@@ -885,6 +888,7 @@ class CombinedOpenEndedModuleConsistencyTest(unittest.TestCase): ...@@ -885,6 +888,7 @@ class CombinedOpenEndedModuleConsistencyTest(unittest.TestCase):
) )
def setUp(self): def setUp(self):
super(CombinedOpenEndedModuleConsistencyTest, self).setUp()
self.combinedoe = CombinedOpenEndedV1Module(self.test_system, self.combinedoe = CombinedOpenEndedV1Module(self.test_system,
self.location, self.location,
self.definition, self.definition,
...@@ -987,6 +991,7 @@ class OpenEndedModuleXmlTest(unittest.TestCase, DummyModulestore): ...@@ -987,6 +991,7 @@ class OpenEndedModuleXmlTest(unittest.TestCase, DummyModulestore):
return test_system return test_system
def setUp(self): def setUp(self):
super(OpenEndedModuleXmlTest, self).setUp()
self.setup_modulestore(COURSE) self.setup_modulestore(COURSE)
def _handle_ajax(self, dispatch, content): def _handle_ajax(self, dispatch, content):
...@@ -1229,6 +1234,7 @@ class OpenEndedModuleXmlAttemptTest(unittest.TestCase, DummyModulestore): ...@@ -1229,6 +1234,7 @@ class OpenEndedModuleXmlAttemptTest(unittest.TestCase, DummyModulestore):
return test_system return test_system
def setUp(self): def setUp(self):
super(OpenEndedModuleXmlAttemptTest, self).setUp()
self.setup_modulestore(COURSE) self.setup_modulestore(COURSE)
def _handle_ajax(self, dispatch, content): def _handle_ajax(self, dispatch, content):
...@@ -1304,6 +1310,7 @@ class OpenEndedModuleXmlImageUploadTest(unittest.TestCase, DummyModulestore): ...@@ -1304,6 +1310,7 @@ class OpenEndedModuleXmlImageUploadTest(unittest.TestCase, DummyModulestore):
return test_system return test_system
def setUp(self): def setUp(self):
super(OpenEndedModuleXmlImageUploadTest, self).setUp()
self.setup_modulestore(COURSE) self.setup_modulestore(COURSE)
def test_file_upload_fail(self): def test_file_upload_fail(self):
......
...@@ -116,6 +116,7 @@ class ConditionalModuleBasicTest(unittest.TestCase): ...@@ -116,6 +116,7 @@ class ConditionalModuleBasicTest(unittest.TestCase):
""" """
def setUp(self): def setUp(self):
super(ConditionalModuleBasicTest, self).setUp()
self.test_system = get_test_system() self.test_system = get_test_system()
def test_icon_class(self): def test_icon_class(self):
...@@ -178,6 +179,7 @@ class ConditionalModuleXmlTest(unittest.TestCase): ...@@ -178,6 +179,7 @@ class ConditionalModuleXmlTest(unittest.TestCase):
return DummySystem(load_error_modules) return DummySystem(load_error_modules)
def setUp(self): def setUp(self):
super(ConditionalModuleXmlTest, self).setUp()
self.test_system = get_test_system() self.test_system = get_test_system()
def get_course(self, name): def get_course(self, name):
......
...@@ -91,6 +91,8 @@ class HasEndedMayCertifyTestCase(unittest.TestCase): ...@@ -91,6 +91,8 @@ class HasEndedMayCertifyTestCase(unittest.TestCase):
"""Double check the semantics around when to finalize courses.""" """Double check the semantics around when to finalize courses."""
def setUp(self): def setUp(self):
super(HasEndedMayCertifyTestCase, self).setUp()
system = DummySystem(load_error_modules=True) system = DummySystem(load_error_modules=True)
#sample_xml = """ #sample_xml = """
# <course org="{org}" course="{course}" display_organization="{org}_display" display_coursenumber="{course}_display" # <course org="{org}" course="{course}" display_organization="{org}_display" display_coursenumber="{course}_display"
...@@ -139,6 +141,8 @@ class IsNewCourseTestCase(unittest.TestCase): ...@@ -139,6 +141,8 @@ class IsNewCourseTestCase(unittest.TestCase):
"""Make sure the property is_new works on courses""" """Make sure the property is_new works on courses"""
def setUp(self): def setUp(self):
super(IsNewCourseTestCase, self).setUp()
# Needed for test_is_newish # Needed for test_is_newish
datetime_patcher = patch.object( datetime_patcher = patch.object(
xmodule.course_module, 'datetime', xmodule.course_module, 'datetime',
......
...@@ -14,8 +14,10 @@ from xblock.fields import ScopeIds ...@@ -14,8 +14,10 @@ from xblock.fields import ScopeIds
from xblock.test.tools import unabc from xblock.test.tools import unabc
class SetupTestErrorModules(): class SetupTestErrorModules(unittest.TestCase):
"""Common setUp for use in ErrorModule tests."""
def setUp(self): def setUp(self):
super(SetupTestErrorModules, self).setUp()
self.system = get_test_system() self.system = get_test_system()
self.course_id = SlashSeparatedCourseKey('org', 'course', 'run') self.course_id = SlashSeparatedCourseKey('org', 'course', 'run')
self.location = self.course_id.make_usage_key('foo', 'bar') self.location = self.course_id.make_usage_key('foo', 'bar')
...@@ -23,13 +25,10 @@ class SetupTestErrorModules(): ...@@ -23,13 +25,10 @@ class SetupTestErrorModules():
self.error_msg = "Error" self.error_msg = "Error"
class TestErrorModule(unittest.TestCase, SetupTestErrorModules): class TestErrorModule(SetupTestErrorModules):
""" """
Tests for ErrorModule and ErrorDescriptor Tests for ErrorModule and ErrorDescriptor
""" """
def setUp(self):
SetupTestErrorModules.setUp(self)
def test_error_module_xml_rendering(self): def test_error_module_xml_rendering(self):
descriptor = ErrorDescriptor.from_xml( descriptor = ErrorDescriptor.from_xml(
self.valid_xml, self.valid_xml,
...@@ -58,13 +57,10 @@ class TestErrorModule(unittest.TestCase, SetupTestErrorModules): ...@@ -58,13 +57,10 @@ class TestErrorModule(unittest.TestCase, SetupTestErrorModules):
self.assertIn(repr(descriptor), context_repr) self.assertIn(repr(descriptor), context_repr)
class TestNonStaffErrorModule(unittest.TestCase, SetupTestErrorModules): class TestNonStaffErrorModule(SetupTestErrorModules):
""" """
Tests for NonStaffErrorModule and NonStaffErrorDescriptor Tests for NonStaffErrorModule and NonStaffErrorDescriptor
""" """
def setUp(self):
SetupTestErrorModules.setUp(self)
def test_non_staff_error_module_create(self): def test_non_staff_error_module_create(self):
descriptor = NonStaffErrorDescriptor.from_xml( descriptor = NonStaffErrorDescriptor.from_xml(
self.valid_xml, self.valid_xml,
...@@ -125,6 +121,7 @@ class TestErrorModuleConstruction(unittest.TestCase): ...@@ -125,6 +121,7 @@ class TestErrorModuleConstruction(unittest.TestCase):
""" """
def setUp(self): def setUp(self):
super(TestErrorModuleConstruction, self).setUp()
field_data = Mock(spec=FieldData) field_data = Mock(spec=FieldData)
self.descriptor = BrokenDescriptor( self.descriptor = BrokenDescriptor(
TestRuntime(Mock(spec=IdReader), field_data), TestRuntime(Mock(spec=IdReader), field_data),
......
...@@ -70,6 +70,7 @@ class RoundTripTestCase(unittest.TestCase): ...@@ -70,6 +70,7 @@ class RoundTripTestCase(unittest.TestCase):
""" """
def setUp(self): def setUp(self):
super(RoundTripTestCase, self).setUp()
self.maxDiff = None self.maxDiff = None
self.temp_dir = mkdtemp() self.temp_dir = mkdtemp()
self.addCleanup(shutil.rmtree, self.temp_dir) self.addCleanup(shutil.rmtree, self.temp_dir)
...@@ -158,6 +159,8 @@ class TestEdxJsonEncoder(unittest.TestCase): ...@@ -158,6 +159,8 @@ class TestEdxJsonEncoder(unittest.TestCase):
Tests for xml_exporter.EdxJSONEncoder Tests for xml_exporter.EdxJSONEncoder
""" """
def setUp(self): def setUp(self):
super(TestEdxJsonEncoder, self).setUp()
self.encoder = EdxJSONEncoder() self.encoder = EdxJSONEncoder()
class OffsetTZ(tzinfo): class OffsetTZ(tzinfo):
...@@ -220,6 +223,7 @@ class ConvertExportFormat(unittest.TestCase): ...@@ -220,6 +223,7 @@ class ConvertExportFormat(unittest.TestCase):
""" """
def setUp(self): def setUp(self):
""" Common setup. """ """ Common setup. """
super(ConvertExportFormat, self).setUp()
# Directory for expanding all the test archives # Directory for expanding all the test archives
self.temp_dir = mkdtemp() self.temp_dir = mkdtemp()
......
...@@ -46,6 +46,8 @@ class ImageAnnotationModuleTestCase(unittest.TestCase): ...@@ -46,6 +46,8 @@ class ImageAnnotationModuleTestCase(unittest.TestCase):
""" """
Makes sure that the Module is declared and mocked with the sample xml above. Makes sure that the Module is declared and mocked with the sample xml above.
""" """
super(ImageAnnotationModuleTestCase, self).setUp()
# return anything except None to test LMS # return anything except None to test LMS
def test_real_user(useless): def test_real_user(useless):
useless_user = Mock(email='fake@fake.com', id=useless) useless_user = Mock(email='fake@fake.com', id=useless)
......
...@@ -48,6 +48,7 @@ class PeerGradingModuleTest(unittest.TestCase, DummyModulestore): ...@@ -48,6 +48,7 @@ class PeerGradingModuleTest(unittest.TestCase, DummyModulestore):
Create a peer grading module from a test system Create a peer grading module from a test system
@return: @return:
""" """
super(PeerGradingModuleTest, self).setUp()
self.setup_modulestore(self.course_id.course) self.setup_modulestore(self.course_id.course)
self.peer_grading = self.get_module_from_location(self.problem_location) self.peer_grading = self.get_module_from_location(self.problem_location)
self.coe = self.get_module_from_location(self.coe_location) self.coe = self.get_module_from_location(self.coe_location)
...@@ -264,6 +265,7 @@ class PeerGradingModuleScoredTest(unittest.TestCase, DummyModulestore): ...@@ -264,6 +265,7 @@ class PeerGradingModuleScoredTest(unittest.TestCase, DummyModulestore):
Create a peer grading module from a test system Create a peer grading module from a test system
@return: @return:
""" """
super(PeerGradingModuleScoredTest, self).setUp()
self.setup_modulestore(self.course_id.course) self.setup_modulestore(self.course_id.course)
def test_metadata_load(self): def test_metadata_load(self):
...@@ -305,6 +307,7 @@ class PeerGradingModuleLinkedTest(unittest.TestCase, DummyModulestore): ...@@ -305,6 +307,7 @@ class PeerGradingModuleLinkedTest(unittest.TestCase, DummyModulestore):
""" """
Create a peer grading module from a test system. Create a peer grading module from a test system.
""" """
super(PeerGradingModuleLinkedTest, self).setUp()
self.setup_modulestore(self.course_id.course) self.setup_modulestore(self.course_id.course)
@property @property
......
...@@ -35,6 +35,8 @@ class SelfAssessmentTest(unittest.TestCase): ...@@ -35,6 +35,8 @@ class SelfAssessmentTest(unittest.TestCase):
descriptor = Mock() descriptor = Mock()
def setUp(self): def setUp(self):
super(SelfAssessmentTest, self).setUp()
self.static_data = { self.static_data = {
'max_attempts': 10, 'max_attempts': 10,
'rubric': etree.XML(self.rubric), 'rubric': etree.XML(self.rubric),
......
...@@ -8,6 +8,7 @@ from opaque_keys.edx.locations import SlashSeparatedCourseKey ...@@ -8,6 +8,7 @@ from opaque_keys.edx.locations import SlashSeparatedCourseKey
class TabTestCase(unittest.TestCase): class TabTestCase(unittest.TestCase):
"""Base class for Tab-related test cases.""" """Base class for Tab-related test cases."""
def setUp(self): def setUp(self):
super(TabTestCase, self).setUp()
self.course = MagicMock() self.course = MagicMock()
self.course.id = SlashSeparatedCourseKey('edX', 'toy', '2012_Fall') self.course.id = SlashSeparatedCourseKey('edX', 'toy', '2012_Fall')
...@@ -450,6 +451,7 @@ class KeyCheckerTestCase(unittest.TestCase): ...@@ -450,6 +451,7 @@ class KeyCheckerTestCase(unittest.TestCase):
"""Test cases for KeyChecker class""" """Test cases for KeyChecker class"""
def setUp(self): def setUp(self):
super(KeyCheckerTestCase, self).setUp()
self.valid_keys = ['a', 'b'] self.valid_keys = ['a', 'b']
self.invalid_keys = ['a', 'v', 'g'] self.invalid_keys = ['a', 'v', 'g']
...@@ -467,6 +469,7 @@ class NeedNameTestCase(unittest.TestCase): ...@@ -467,6 +469,7 @@ class NeedNameTestCase(unittest.TestCase):
"""Test cases for NeedName validator""" """Test cases for NeedName validator"""
def setUp(self): def setUp(self):
super(NeedNameTestCase, self).setUp()
self.valid_dict1 = {'a': 1, 'name': 2} self.valid_dict1 = {'a': 1, 'name': 2}
self.valid_dict2 = {'name': 1} self.valid_dict2 = {'name': 1}
......
...@@ -31,6 +31,8 @@ class TextAnnotationModuleTestCase(unittest.TestCase): ...@@ -31,6 +31,8 @@ class TextAnnotationModuleTestCase(unittest.TestCase):
""" """
Makes sure that the Module is declared and mocked with the sample xml above. Makes sure that the Module is declared and mocked with the sample xml above.
""" """
super(TextAnnotationModuleTestCase, self).setUp()
# return anything except None to test LMS # return anything except None to test LMS
def test_real_user(useless): def test_real_user(useless):
useless_user = Mock(email='fake@fake.com', id=useless) useless_user = Mock(email='fake@fake.com', id=useless)
......
...@@ -14,6 +14,7 @@ class BaseVerticalModuleTest(XModuleXmlImportTest): ...@@ -14,6 +14,7 @@ class BaseVerticalModuleTest(XModuleXmlImportTest):
test_html_2 = 'Test HTML 2' test_html_2 = 'Test HTML 2'
def setUp(self): def setUp(self):
super(BaseVerticalModuleTest, self).setUp()
# construct module # construct module
course = xml.CourseFactory.build() course = xml.CourseFactory.build()
sequence = xml.SequenceFactory.build(parent=course) sequence = xml.SequenceFactory.build(parent=course)
......
...@@ -185,6 +185,7 @@ class VideoDescriptorTestBase(unittest.TestCase): ...@@ -185,6 +185,7 @@ class VideoDescriptorTestBase(unittest.TestCase):
""" """
def setUp(self): def setUp(self):
super(VideoDescriptorTestBase, self).setUp()
self.descriptor = instantiate_descriptor() self.descriptor = instantiate_descriptor()
......
...@@ -27,6 +27,8 @@ class VideoAnnotationModuleTestCase(unittest.TestCase): ...@@ -27,6 +27,8 @@ class VideoAnnotationModuleTestCase(unittest.TestCase):
""" """
Makes sure that the Video Annotation Module is created. Makes sure that the Video Annotation Module is created.
""" """
super(VideoAnnotationModuleTestCase, self).setUp()
# return anything except None to test LMS # return anything except None to test LMS
def test_real_user(useless): def test_real_user(useless):
useless_user = Mock(email='fake@fake.com', id=useless) useless_user = Mock(email='fake@fake.com', id=useless)
......
...@@ -362,6 +362,7 @@ class TestXModuleHandler(TestCase): ...@@ -362,6 +362,7 @@ class TestXModuleHandler(TestCase):
""" """
def setUp(self): def setUp(self):
super(TestXModuleHandler, self).setUp()
self.module = XModule(descriptor=Mock(), field_data=Mock(), runtime=Mock(), scope_ids=Mock()) self.module = XModule(descriptor=Mock(), field_data=Mock(), runtime=Mock(), scope_ids=Mock())
self.module.handle_ajax = Mock(return_value='{}') self.module.handle_ajax = Mock(return_value='{}')
self.request = webob.Request({}) self.request = webob.Request({})
......
...@@ -64,6 +64,7 @@ class InheritingFieldDataTest(unittest.TestCase): ...@@ -64,6 +64,7 @@ class InheritingFieldDataTest(unittest.TestCase):
not_inherited = String(scope=Scope.settings, default="nothing") not_inherited = String(scope=Scope.settings, default="nothing")
def setUp(self): def setUp(self):
super(InheritingFieldDataTest, self).setUp()
self.system = get_test_descriptor_system() self.system = get_test_descriptor_system()
self.all_blocks = {} self.all_blocks = {}
self.system.get_block = self.all_blocks.get self.system.get_block = self.all_blocks.get
......
...@@ -123,6 +123,8 @@ class PreRequisiteCourseCatalog(ModuleStoreTestCase, LoginEnrollmentTestCase): ...@@ -123,6 +123,8 @@ class PreRequisiteCourseCatalog(ModuleStoreTestCase, LoginEnrollmentTestCase):
""" """
@patch.dict(settings.FEATURES, {'ENABLE_PREREQUISITE_COURSES': True, 'MILESTONES_APP': True}) @patch.dict(settings.FEATURES, {'ENABLE_PREREQUISITE_COURSES': True, 'MILESTONES_APP': True})
def setUp(self): def setUp(self):
super(PreRequisiteCourseCatalog, self).setUp()
seed_milestone_relationship_types() seed_milestone_relationship_types()
@patch.dict(settings.FEATURES, {'ENABLE_PREREQUISITE_COURSES': True, 'MILESTONES_APP': True}) @patch.dict(settings.FEATURES, {'ENABLE_PREREQUISITE_COURSES': True, 'MILESTONES_APP': True})
......
...@@ -27,6 +27,7 @@ class TestOptoutCourseEmails(ModuleStoreTestCase): ...@@ -27,6 +27,7 @@ class TestOptoutCourseEmails(ModuleStoreTestCase):
""" """
def setUp(self): def setUp(self):
super(TestOptoutCourseEmails, self).setUp()
course_title = u"ẗëṡẗ title イ乇丂イ ᄊ乇丂丂ムg乇 キo尺 ムレレ тэѕт мэѕѕаБэ" course_title = u"ẗëṡẗ title イ乇丂イ ᄊ乇丂丂ムg乇 キo尺 ムレレ тэѕт мэѕѕаБэ"
self.course = CourseFactory.create(display_name=course_title) self.course = CourseFactory.create(display_name=course_title)
self.instructor = AdminFactory.create() self.instructor = AdminFactory.create()
......
...@@ -51,6 +51,7 @@ class EmailSendFromDashboardTestCase(ModuleStoreTestCase): ...@@ -51,6 +51,7 @@ class EmailSendFromDashboardTestCase(ModuleStoreTestCase):
@patch.dict(settings.FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': False}) @patch.dict(settings.FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': False})
def setUp(self): def setUp(self):
super(EmailSendFromDashboardTestCase, self).setUp()
course_title = u"ẗëṡẗ title イ乇丂イ ᄊ乇丂丂ムg乇 キo尺 ムレレ тэѕт мэѕѕаБэ" course_title = u"ẗëṡẗ title イ乇丂イ ᄊ乇丂丂ムg乇 キo尺 ムレレ тэѕт мэѕѕаБэ"
self.course = CourseFactory.create(display_name=course_title) self.course = CourseFactory.create(display_name=course_title)
......
...@@ -46,6 +46,7 @@ class TestEmailErrors(ModuleStoreTestCase): ...@@ -46,6 +46,7 @@ class TestEmailErrors(ModuleStoreTestCase):
""" """
def setUp(self): def setUp(self):
super(TestEmailErrors, self).setUp()
course_title = u"ẗëṡẗ title イ乇丂イ ᄊ乇丂丂ムg乇 キo尺 ムレレ тэѕт мэѕѕаБэ" course_title = u"ẗëṡẗ title イ乇丂イ ᄊ乇丂丂ムg乇 キo尺 ムレレ тэѕт мэѕѕаБэ"
self.course = CourseFactory.create(display_name=course_title) self.course = CourseFactory.create(display_name=course_title)
self.instructor = AdminFactory.create() self.instructor = AdminFactory.create()
......
...@@ -23,6 +23,7 @@ class CourseAuthorizationFormTest(ModuleStoreTestCase): ...@@ -23,6 +23,7 @@ class CourseAuthorizationFormTest(ModuleStoreTestCase):
"""Test the CourseAuthorizationAdminForm form for Mongo-backed courses.""" """Test the CourseAuthorizationAdminForm form for Mongo-backed courses."""
def setUp(self): def setUp(self):
super(CourseAuthorizationFormTest, self).setUp()
course_title = u"ẗëṡẗ title イ乇丂イ ᄊ乇丂丂ムg乇 キo尺 ムレレ тэѕт мэѕѕаБэ" course_title = u"ẗëṡẗ title イ乇丂イ ᄊ乇丂丂ムg乇 キo尺 ムレレ тэѕт мэѕѕаБэ"
self.course = CourseFactory.create(display_name=course_title) self.course = CourseFactory.create(display_name=course_title)
......
...@@ -69,6 +69,8 @@ class CourseEmailTemplateTest(TestCase): ...@@ -69,6 +69,8 @@ class CourseEmailTemplateTest(TestCase):
"""Test the CourseEmailTemplate model.""" """Test the CourseEmailTemplate model."""
def setUp(self): def setUp(self):
super(CourseEmailTemplateTest, self).setUp()
# load initial content (since we don't run migrations as part of tests): # load initial content (since we don't run migrations as part of tests):
call_command("loaddata", "course_email_template.json") call_command("loaddata", "course_email_template.json")
......
...@@ -34,6 +34,7 @@ class TestGetProblemGradeDistribution(ModuleStoreTestCase): ...@@ -34,6 +34,7 @@ class TestGetProblemGradeDistribution(ModuleStoreTestCase):
""" """
def setUp(self): def setUp(self):
super(TestGetProblemGradeDistribution, self).setUp()
self.request_factory = RequestFactory() self.request_factory = RequestFactory()
self.instructor = AdminFactory.create() self.instructor = AdminFactory.create()
......
...@@ -21,6 +21,7 @@ class TestViews(ModuleStoreTestCase): ...@@ -21,6 +21,7 @@ class TestViews(ModuleStoreTestCase):
""" """
def setUp(self): def setUp(self):
super(TestViews, self).setUp()
self.request_factory = RequestFactory() self.request_factory = RequestFactory()
self.request = self.request_factory.get('') self.request = self.request_factory.get('')
......
...@@ -21,6 +21,7 @@ from course_wiki import settings ...@@ -21,6 +21,7 @@ from course_wiki import settings
class TestWikiAccessBase(ModuleStoreTestCase): class TestWikiAccessBase(ModuleStoreTestCase):
"""Base class for testing wiki access.""" """Base class for testing wiki access."""
def setUp(self): def setUp(self):
super(TestWikiAccessBase, self).setUp()
self.wiki = get_or_create_root() self.wiki = get_or_create_root()
......
...@@ -20,6 +20,8 @@ class TestWikiAccessMiddleware(ModuleStoreTestCase): ...@@ -20,6 +20,8 @@ class TestWikiAccessMiddleware(ModuleStoreTestCase):
def setUp(self): def setUp(self):
"""Test setup.""" """Test setup."""
super(TestWikiAccessMiddleware, self).setUp()
self.wiki = get_or_create_root() self.wiki = get_or_create_root()
self.course_math101 = CourseFactory.create(org='edx', number='math101', display_name='2014', metadata={'use_unique_wiki_id': 'false'}) self.course_math101 = CourseFactory.create(org='edx', number='math101', display_name='2014', metadata={'use_unique_wiki_id': 'false'})
......
...@@ -14,11 +14,9 @@ class WikiRedirectTestCase(LoginEnrollmentTestCase): ...@@ -14,11 +14,9 @@ class WikiRedirectTestCase(LoginEnrollmentTestCase):
Tests for wiki course redirection. Tests for wiki course redirection.
""" """
@classmethod
def setUpClass(cls):
cls.toy = CourseFactory.create(org='edX', course='toy', display_name='2012_Fall')
def setUp(self): def setUp(self):
super(WikiRedirectTestCase, self).setUp()
self.toy = CourseFactory.create(org='edX', course='toy', display_name='2012_Fall')
# Create two accounts # Create two accounts
self.student = 'view@test.com' self.student = 'view@test.com'
......
...@@ -46,6 +46,7 @@ class CommandsTestBase(TestCase): ...@@ -46,6 +46,7 @@ class CommandsTestBase(TestCase):
""" """
def setUp(self): def setUp(self):
super(CommandsTestBase, self).setUp()
self.loaded_courses = self.load_courses() self.loaded_courses = self.load_courses()
def load_courses(self): def load_courses(self):
......
...@@ -39,6 +39,7 @@ class AboutTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase): ...@@ -39,6 +39,7 @@ class AboutTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase):
Tests about xblock. Tests about xblock.
""" """
def setUp(self): def setUp(self):
super(AboutTestCase, self).setUp()
self.course = CourseFactory.create() self.course = CourseFactory.create()
self.about = ItemFactory.create( self.about = ItemFactory.create(
category="about", parent_location=self.course.location, category="about", parent_location=self.course.location,
...@@ -220,6 +221,7 @@ class AboutWithCappedEnrollmentsTestCase(LoginEnrollmentTestCase, ModuleStoreTes ...@@ -220,6 +221,7 @@ class AboutWithCappedEnrollmentsTestCase(LoginEnrollmentTestCase, ModuleStoreTes
""" """
Set up the tests Set up the tests
""" """
super(AboutWithCappedEnrollmentsTestCase, self).setUp()
self.course = CourseFactory.create(metadata={"max_student_enrollments_allowed": 1}) self.course = CourseFactory.create(metadata={"max_student_enrollments_allowed": 1})
self.about = ItemFactory.create( self.about = ItemFactory.create(
...@@ -267,6 +269,7 @@ class AboutWithInvitationOnly(ModuleStoreTestCase): ...@@ -267,6 +269,7 @@ class AboutWithInvitationOnly(ModuleStoreTestCase):
This test case will check the About page when a course is invitation only. This test case will check the About page when a course is invitation only.
""" """
def setUp(self): def setUp(self):
super(AboutWithInvitationOnly, self).setUp()
self.course = CourseFactory.create(metadata={"invitation_only": True}) self.course = CourseFactory.create(metadata={"invitation_only": True})
...@@ -314,6 +317,7 @@ class AboutTestCaseShibCourse(LoginEnrollmentTestCase, ModuleStoreTestCase): ...@@ -314,6 +317,7 @@ class AboutTestCaseShibCourse(LoginEnrollmentTestCase, ModuleStoreTestCase):
Test cases covering about page behavior for courses that use shib enrollment domain ("shib courses") Test cases covering about page behavior for courses that use shib enrollment domain ("shib courses")
""" """
def setUp(self): def setUp(self):
super(AboutTestCaseShibCourse, self).setUp()
self.course = CourseFactory.create(enrollment_domain="shib:https://idp.stanford.edu/") self.course = CourseFactory.create(enrollment_domain="shib:https://idp.stanford.edu/")
self.about = ItemFactory.create( self.about = ItemFactory.create(
......
...@@ -32,6 +32,7 @@ class AccessTestCase(LoginEnrollmentTestCase): ...@@ -32,6 +32,7 @@ class AccessTestCase(LoginEnrollmentTestCase):
Tests for the various access controls on the student dashboard Tests for the various access controls on the student dashboard
""" """
def setUp(self): def setUp(self):
super(AccessTestCase, self).setUp()
course_key = SlashSeparatedCourseKey('edX', 'toy', '2012_Fall') course_key = SlashSeparatedCourseKey('edX', 'toy', '2012_Fall')
self.course = course_key.make_usage_key('course', course_key.run) self.course = course_key.make_usage_key('course', course_key.run)
self.anonymous_user = AnonymousUserFactory() self.anonymous_user = AnonymousUserFactory()
...@@ -329,6 +330,7 @@ class UserRoleTestCase(TestCase): ...@@ -329,6 +330,7 @@ class UserRoleTestCase(TestCase):
Tests for user roles. Tests for user roles.
""" """
def setUp(self): def setUp(self):
super(UserRoleTestCase, self).setUp()
self.course_key = SlashSeparatedCourseKey('edX', 'toy', '2012_Fall') self.course_key = SlashSeparatedCourseKey('edX', 'toy', '2012_Fall')
self.anonymous_user = AnonymousUserFactory() self.anonymous_user = AnonymousUserFactory()
self.student = UserFactory() self.student = UserFactory()
......
...@@ -21,6 +21,7 @@ class CourseInfoTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase): ...@@ -21,6 +21,7 @@ class CourseInfoTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase):
Tests for the Course Info page Tests for the Course Info page
""" """
def setUp(self): def setUp(self):
super(CourseInfoTestCase, self).setUp()
self.course = CourseFactory.create() self.course = CourseFactory.create()
self.page = ItemFactory.create( self.page = ItemFactory.create(
category="course_info", parent_location=self.course.location, category="course_info", parent_location=self.course.location,
......
...@@ -39,6 +39,8 @@ class TestGradeIteration(ModuleStoreTestCase): ...@@ -39,6 +39,8 @@ class TestGradeIteration(ModuleStoreTestCase):
""" """
Create a course and a handful of users to assign grades Create a course and a handful of users to assign grades
""" """
super(TestGradeIteration, self).setUp()
self.course = CourseFactory.create( self.course = CourseFactory.create(
display_name=self.COURSE_NAME, display_name=self.COURSE_NAME,
number=self.COURSE_NUM number=self.COURSE_NUM
......
...@@ -72,6 +72,7 @@ class GroupAccessTestCase(ModuleStoreTestCase): ...@@ -72,6 +72,7 @@ class GroupAccessTestCase(ModuleStoreTestCase):
modulestore().update_item(block, 1) modulestore().update_item(block, 1)
def setUp(self): def setUp(self):
super(GroupAccessTestCase, self).setUp()
UserPartition.scheme_extensions = ExtensionManager.make_test_instance( UserPartition.scheme_extensions = ExtensionManager.make_test_instance(
[ [
......
...@@ -135,6 +135,7 @@ class TestLTIModuleListing(ModuleStoreTestCase): ...@@ -135,6 +135,7 @@ class TestLTIModuleListing(ModuleStoreTestCase):
def setUp(self): def setUp(self):
"""Create course, 2 chapters, 2 sections""" """Create course, 2 chapters, 2 sections"""
super(TestLTIModuleListing, self).setUp()
self.course = CourseFactory.create(display_name=self.COURSE_NAME, number=self.COURSE_SLUG) self.course = CourseFactory.create(display_name=self.COURSE_NAME, number=self.COURSE_SLUG)
self.chapter1 = ItemFactory.create( self.chapter1 = ItemFactory.create(
parent_location=self.course.location, parent_location=self.course.location,
......
...@@ -26,6 +26,8 @@ class MasqueradeTestCase(ModuleStoreTestCase, LoginEnrollmentTestCase): ...@@ -26,6 +26,8 @@ class MasqueradeTestCase(ModuleStoreTestCase, LoginEnrollmentTestCase):
Base class for masquerade tests that sets up a test course and enrolls a user in the course. Base class for masquerade tests that sets up a test course and enrolls a user in the course.
""" """
def setUp(self): def setUp(self):
super(MasqueradeTestCase, self).setUp()
# By default, tests run with DISABLE_START_DATES=True. To test that masquerading as a student is # By default, tests run with DISABLE_START_DATES=True. To test that masquerading as a student is
# working properly, we must use start dates and set a start date in the past (otherwise the access # working properly, we must use start dates and set a start date in the past (otherwise the access
# checks exist prematurely). # checks exist prematurely).
......
...@@ -23,6 +23,8 @@ class TestMicrosites(ModuleStoreTestCase, LoginEnrollmentTestCase): ...@@ -23,6 +23,8 @@ class TestMicrosites(ModuleStoreTestCase, LoginEnrollmentTestCase):
STUDENT_INFO = [('view@test.com', 'foo'), ('view2@test.com', 'foo')] STUDENT_INFO = [('view@test.com', 'foo'), ('view2@test.com', 'foo')]
def setUp(self): def setUp(self):
super(TestMicrosites, self).setUp()
# use a different hostname to test Microsites since they are # use a different hostname to test Microsites since they are
# triggered on subdomain mappings # triggered on subdomain mappings
# #
......
...@@ -20,6 +20,8 @@ class CoursewareMiddlewareTestCase(ModuleStoreTestCase): ...@@ -20,6 +20,8 @@ class CoursewareMiddlewareTestCase(ModuleStoreTestCase):
"""Tests that courseware middleware is correctly redirected""" """Tests that courseware middleware is correctly redirected"""
def setUp(self): def setUp(self):
super(CoursewareMiddlewareTestCase, self).setUp()
self.course = CourseFactory.create() self.course = CourseFactory.create()
def check_user_not_enrolled_redirect(self): def check_user_not_enrolled_redirect(self):
......
...@@ -54,6 +54,7 @@ class StudentModuleFactory(cmfStudentModuleFactory): ...@@ -54,6 +54,7 @@ class StudentModuleFactory(cmfStudentModuleFactory):
class TestInvalidScopes(TestCase): class TestInvalidScopes(TestCase):
def setUp(self): def setUp(self):
super(TestInvalidScopes, self).setUp()
self.user = UserFactory.create(username='user') self.user = UserFactory.create(username='user')
self.field_data_cache = FieldDataCache([mock_descriptor([mock_field(Scope.user_state, 'a_field')])], course_id, self.user) self.field_data_cache = FieldDataCache([mock_descriptor([mock_field(Scope.user_state, 'a_field')])], course_id, self.user)
self.kvs = DjangoKeyValueStore(self.field_data_cache) self.kvs = DjangoKeyValueStore(self.field_data_cache)
...@@ -101,6 +102,7 @@ class TestStudentModuleStorage(OtherUserFailureTestMixin, TestCase): ...@@ -101,6 +102,7 @@ class TestStudentModuleStorage(OtherUserFailureTestMixin, TestCase):
existing_field_name = "a_field" existing_field_name = "a_field"
def setUp(self): def setUp(self):
super(TestStudentModuleStorage, self).setUp()
student_module = StudentModuleFactory(state=json.dumps({'a_field': 'a_value', 'b_field': 'b_value'})) student_module = StudentModuleFactory(state=json.dumps({'a_field': 'a_value', 'b_field': 'b_value'}))
self.user = student_module.student self.user = student_module.student
self.assertEqual(self.user.id, 1) # check our assumption hard-coded in the key functions above. self.assertEqual(self.user.id, 1) # check our assumption hard-coded in the key functions above.
...@@ -179,6 +181,8 @@ class TestStudentModuleStorage(OtherUserFailureTestMixin, TestCase): ...@@ -179,6 +181,8 @@ class TestStudentModuleStorage(OtherUserFailureTestMixin, TestCase):
class TestMissingStudentModule(TestCase): class TestMissingStudentModule(TestCase):
def setUp(self): def setUp(self):
super(TestMissingStudentModule, self).setUp()
self.user = UserFactory.create(username='user') self.user = UserFactory.create(username='user')
self.assertEqual(self.user.id, 1) # check our assumption hard-coded in the key functions above. self.assertEqual(self.user.id, 1) # check our assumption hard-coded in the key functions above.
self.field_data_cache = FieldDataCache([mock_descriptor()], course_id, self.user) self.field_data_cache = FieldDataCache([mock_descriptor()], course_id, self.user)
......
...@@ -506,6 +506,7 @@ class TestHtmlModifiers(ModuleStoreTestCase): ...@@ -506,6 +506,7 @@ class TestHtmlModifiers(ModuleStoreTestCase):
student_view are taking place student_view are taking place
""" """
def setUp(self): def setUp(self):
super(TestHtmlModifiers, self).setUp()
self.user = UserFactory.create() self.user = UserFactory.create()
self.request = RequestFactory().get('/') self.request = RequestFactory().get('/')
self.request.user = self.user self.request.user = self.user
...@@ -637,6 +638,7 @@ class ViewInStudioTest(ModuleStoreTestCase): ...@@ -637,6 +638,7 @@ class ViewInStudioTest(ModuleStoreTestCase):
def setUp(self): def setUp(self):
""" Set up the user and request that will be used. """ """ Set up the user and request that will be used. """
super(ViewInStudioTest, self).setUp()
self.staff_user = GlobalStaffFactory.create() self.staff_user = GlobalStaffFactory.create()
self.request = RequestFactory().get('/') self.request = RequestFactory().get('/')
self.request.user = self.staff_user self.request.user = self.staff_user
...@@ -697,9 +699,6 @@ class ViewInStudioTest(ModuleStoreTestCase): ...@@ -697,9 +699,6 @@ class ViewInStudioTest(ModuleStoreTestCase):
class MongoViewInStudioTest(ViewInStudioTest): class MongoViewInStudioTest(ViewInStudioTest):
"""Test the 'View in Studio' link visibility in a mongo backed course.""" """Test the 'View in Studio' link visibility in a mongo backed course."""
def setUp(self):
super(MongoViewInStudioTest, self).setUp()
def test_view_in_studio_link_studio_course(self): def test_view_in_studio_link_studio_course(self):
"""Regular Studio courses should see 'View in Studio' links.""" """Regular Studio courses should see 'View in Studio' links."""
self.setup_mongo_course() self.setup_mongo_course()
...@@ -772,6 +771,7 @@ class TestStaffDebugInfo(ModuleStoreTestCase): ...@@ -772,6 +771,7 @@ class TestStaffDebugInfo(ModuleStoreTestCase):
"""Tests to verify that Staff Debug Info panel and histograms are displayed to staff.""" """Tests to verify that Staff Debug Info panel and histograms are displayed to staff."""
def setUp(self): def setUp(self):
super(TestStaffDebugInfo, self).setUp()
self.user = UserFactory.create() self.user = UserFactory.create()
self.request = RequestFactory().get('/') self.request = RequestFactory().get('/')
self.request.user = self.user self.request.user = self.user
...@@ -893,6 +893,7 @@ class TestAnonymousStudentId(ModuleStoreTestCase, LoginEnrollmentTestCase): ...@@ -893,6 +893,7 @@ class TestAnonymousStudentId(ModuleStoreTestCase, LoginEnrollmentTestCase):
""" """
def setUp(self): def setUp(self):
super(TestAnonymousStudentId, self).setUp(create_user=False)
self.user = UserFactory() self.user = UserFactory()
@patch('courseware.module_render.has_access', Mock(return_value=True)) @patch('courseware.module_render.has_access', Mock(return_value=True))
...@@ -961,6 +962,8 @@ class TestModuleTrackingContext(ModuleStoreTestCase): ...@@ -961,6 +962,8 @@ class TestModuleTrackingContext(ModuleStoreTestCase):
""" """
def setUp(self): def setUp(self):
super(TestModuleTrackingContext, self).setUp()
self.user = UserFactory.create() self.user = UserFactory.create()
self.request = RequestFactory().get('/') self.request = RequestFactory().get('/')
self.request.user = self.user self.request.user = self.user
......
...@@ -35,6 +35,8 @@ class TestRecommender(ModuleStoreTestCase, LoginEnrollmentTestCase): ...@@ -35,6 +35,8 @@ class TestRecommender(ModuleStoreTestCase, LoginEnrollmentTestCase):
XBLOCK_NAMES = ['recommender', 'recommender_second'] XBLOCK_NAMES = ['recommender', 'recommender_second']
def setUp(self): def setUp(self):
super(TestRecommender, self).setUp()
self.course = CourseFactory.create( self.course = CourseFactory.create(
display_name='Recommender_Test_Course' display_name='Recommender_Test_Course'
) )
......
...@@ -29,6 +29,7 @@ class SplitTestBase(ModuleStoreTestCase): ...@@ -29,6 +29,7 @@ class SplitTestBase(ModuleStoreTestCase):
VISIBLE_CONTENT = None VISIBLE_CONTENT = None
def setUp(self): def setUp(self):
super(SplitTestBase, self).setUp()
self.partition = UserPartition( self.partition = UserPartition(
0, 0,
'first_partition', 'first_partition',
...@@ -276,6 +277,8 @@ class SplitTestPosition(ModuleStoreTestCase): ...@@ -276,6 +277,8 @@ class SplitTestPosition(ModuleStoreTestCase):
Check that we can change positions in a course with partitions defined Check that we can change positions in a course with partitions defined
""" """
def setUp(self): def setUp(self):
super(SplitTestPosition, self).setUp()
self.partition = UserPartition( self.partition = UserPartition(
0, 0,
'first_partition', 'first_partition',
......
...@@ -31,6 +31,7 @@ class StaticTabDateTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase): ...@@ -31,6 +31,7 @@ class StaticTabDateTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase):
"""Test cases for Static Tab Dates.""" """Test cases for Static Tab Dates."""
def setUp(self): def setUp(self):
super(StaticTabDateTestCase, self).setUp()
self.course = CourseFactory.create() self.course = CourseFactory.create()
self.page = ItemFactory.create( self.page = ItemFactory.create(
category="static_tab", parent_location=self.course.location, category="static_tab", parent_location=self.course.location,
...@@ -117,6 +118,8 @@ class EntranceExamsTabsTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase): ...@@ -117,6 +118,8 @@ class EntranceExamsTabsTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase):
""" """
Test case scaffolding Test case scaffolding
""" """
super(EntranceExamsTabsTestCase, self).setUp()
self.course = CourseFactory.create() self.course = CourseFactory.create()
self.instructor_tab = ItemFactory.create( self.instructor_tab = ItemFactory.create(
category="instructor", parent_location=self.course.location, category="instructor", parent_location=self.course.location,
......
...@@ -150,6 +150,7 @@ class TestGetHtmlMethod(BaseTestXmodule): ...@@ -150,6 +150,7 @@ class TestGetHtmlMethod(BaseTestXmodule):
METADATA = {} METADATA = {}
def setUp(self): def setUp(self):
super(TestGetHtmlMethod, self).setUp()
self.setup_course() self.setup_course()
def test_get_html_track(self): def test_get_html_track(self):
...@@ -766,6 +767,7 @@ class TestVideoDescriptorInitialization(BaseTestXmodule): ...@@ -766,6 +767,7 @@ class TestVideoDescriptorInitialization(BaseTestXmodule):
METADATA = {} METADATA = {}
def setUp(self): def setUp(self):
super(TestVideoDescriptorInitialization, self).setUp()
self.setup_course() self.setup_course()
def test_source_not_in_html5sources(self): def test_source_not_in_html5sources(self):
......
...@@ -395,6 +395,7 @@ class TestBetatesterAccess(ModuleStoreTestCase): ...@@ -395,6 +395,7 @@ class TestBetatesterAccess(ModuleStoreTestCase):
Tests for the beta tester feature Tests for the beta tester feature
""" """
def setUp(self): def setUp(self):
super(TestBetatesterAccess, self).setUp()
now = datetime.datetime.now(pytz.UTC) now = datetime.datetime.now(pytz.UTC)
tomorrow = now + datetime.timedelta(days=1) tomorrow = now + datetime.timedelta(days=1)
......
...@@ -36,12 +36,13 @@ from util.views import ensure_valid_course_key ...@@ -36,12 +36,13 @@ from util.views import ensure_valid_course_key
@override_settings(MODULESTORE=TEST_DATA_MIXED_TOY_MODULESTORE) @override_settings(MODULESTORE=TEST_DATA_MIXED_TOY_MODULESTORE)
class TestJumpTo(TestCase): class TestJumpTo(ModuleStoreTestCase):
""" """
Check the jumpto link for a course. Check the jumpto link for a course.
""" """
def setUp(self): def setUp(self):
super(TestJumpTo, self).setUp()
# Use toy course from XML # Use toy course from XML
self.course_key = SlashSeparatedCourseKey('edX', 'toy', '2012_Fall') self.course_key = SlashSeparatedCourseKey('edX', 'toy', '2012_Fall')
...@@ -82,6 +83,7 @@ class ViewsTestCase(TestCase): ...@@ -82,6 +83,7 @@ class ViewsTestCase(TestCase):
Tests for views.py methods. Tests for views.py methods.
""" """
def setUp(self): def setUp(self):
super(ViewsTestCase, self).setUp()
self.course = CourseFactory.create() self.course = CourseFactory.create()
self.chapter = ItemFactory.create(category='chapter', parent_location=self.course.location) # pylint: disable=no-member self.chapter = ItemFactory.create(category='chapter', parent_location=self.course.location) # pylint: disable=no-member
self.section = ItemFactory.create(category='sequential', parent_location=self.chapter.location, due=datetime(2013, 9, 18, 11, 30, 00)) self.section = ItemFactory.create(category='sequential', parent_location=self.chapter.location, due=datetime(2013, 9, 18, 11, 30, 00))
...@@ -493,6 +495,7 @@ class BaseDueDateTests(ModuleStoreTestCase): ...@@ -493,6 +495,7 @@ class BaseDueDateTests(ModuleStoreTestCase):
return course return course
def setUp(self): def setUp(self):
super(BaseDueDateTests, self).setUp()
self.request_factory = RequestFactory() self.request_factory = RequestFactory()
self.user = UserFactory.create() self.user = UserFactory.create()
self.request = self.request_factory.get("foo") self.request = self.request_factory.get("foo")
...@@ -588,6 +591,7 @@ class StartDateTests(ModuleStoreTestCase): ...@@ -588,6 +591,7 @@ class StartDateTests(ModuleStoreTestCase):
""" """
def setUp(self): def setUp(self):
super(StartDateTests, self).setUp()
self.request_factory = RequestFactory() self.request_factory = RequestFactory()
self.user = UserFactory.create() self.user = UserFactory.create()
self.request = self.request_factory.get("foo") self.request = self.request_factory.get("foo")
...@@ -642,6 +646,7 @@ class ProgressPageTests(ModuleStoreTestCase): ...@@ -642,6 +646,7 @@ class ProgressPageTests(ModuleStoreTestCase):
""" """
def setUp(self): def setUp(self):
super(ProgressPageTests, self).setUp()
self.request_factory = RequestFactory() self.request_factory = RequestFactory()
self.user = UserFactory.create() self.user = UserFactory.create()
self.request = self.request_factory.get("foo") self.request = self.request_factory.get("foo")
...@@ -676,6 +681,8 @@ class VerifyCourseKeyDecoratorTests(TestCase): ...@@ -676,6 +681,8 @@ class VerifyCourseKeyDecoratorTests(TestCase):
""" """
def setUp(self): def setUp(self):
super(VerifyCourseKeyDecoratorTests, self).setUp()
self.request = RequestFactory().get("foo") self.request = RequestFactory().get("foo")
self.valid_course_id = "edX/test/1" self.valid_course_id = "edX/test/1"
self.invalid_course_id = "edX/" self.invalid_course_id = "edX/"
......
...@@ -23,6 +23,7 @@ class ActivateLoginTest(LoginEnrollmentTestCase): ...@@ -23,6 +23,7 @@ class ActivateLoginTest(LoginEnrollmentTestCase):
Test logging in and logging out. Test logging in and logging out.
""" """
def setUp(self): def setUp(self):
super(ActivateLoginTest, self).setUp()
self.setup_user() self.setup_user()
def test_activate_login(self): def test_activate_login(self):
......
...@@ -22,6 +22,8 @@ class RefundTests(ModuleStoreTestCase): ...@@ -22,6 +22,8 @@ class RefundTests(ModuleStoreTestCase):
Tests for the manual refund page Tests for the manual refund page
""" """
def setUp(self): def setUp(self):
super(RefundTests, self).setUp()
self.course = CourseFactory.create( self.course = CourseFactory.create(
org='testorg', number='run1', display_name='refundable course' org='testorg', number='run1', display_name='refundable course'
) )
......
...@@ -847,6 +847,8 @@ class ViewPermissionsTestCase(UrlResetMixin, ModuleStoreTestCase, MockRequestSet ...@@ -847,6 +847,8 @@ class ViewPermissionsTestCase(UrlResetMixin, ModuleStoreTestCase, MockRequestSet
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE) @override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class CreateThreadUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin, MockRequestSetupMixin): class CreateThreadUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin, MockRequestSetupMixin):
def setUp(self): def setUp(self):
super(CreateThreadUnicodeTestCase, self).setUp()
self.course = CourseFactory.create() self.course = CourseFactory.create()
seed_permissions_roles(self.course.id) seed_permissions_roles(self.course.id)
self.student = UserFactory.create() self.student = UserFactory.create()
...@@ -869,6 +871,8 @@ class CreateThreadUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin, MockReq ...@@ -869,6 +871,8 @@ class CreateThreadUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin, MockReq
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE) @override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class UpdateThreadUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin, MockRequestSetupMixin): class UpdateThreadUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin, MockRequestSetupMixin):
def setUp(self): def setUp(self):
super(UpdateThreadUnicodeTestCase, self).setUp()
self.course = CourseFactory.create() self.course = CourseFactory.create()
seed_permissions_roles(self.course.id) seed_permissions_roles(self.course.id)
self.student = UserFactory.create() self.student = UserFactory.create()
...@@ -897,6 +901,8 @@ class UpdateThreadUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin, MockReq ...@@ -897,6 +901,8 @@ class UpdateThreadUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin, MockReq
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE) @override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class CreateCommentUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin, MockRequestSetupMixin): class CreateCommentUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin, MockRequestSetupMixin):
def setUp(self): def setUp(self):
super(CreateCommentUnicodeTestCase, self).setUp()
self.course = CourseFactory.create() self.course = CourseFactory.create()
seed_permissions_roles(self.course.id) seed_permissions_roles(self.course.id)
self.student = UserFactory.create() self.student = UserFactory.create()
...@@ -920,6 +926,8 @@ class CreateCommentUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin, MockRe ...@@ -920,6 +926,8 @@ class CreateCommentUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin, MockRe
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE) @override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class UpdateCommentUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin, MockRequestSetupMixin): class UpdateCommentUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin, MockRequestSetupMixin):
def setUp(self): def setUp(self):
super(UpdateCommentUnicodeTestCase, self).setUp()
self.course = CourseFactory.create() self.course = CourseFactory.create()
seed_permissions_roles(self.course.id) seed_permissions_roles(self.course.id)
self.student = UserFactory.create() self.student = UserFactory.create()
...@@ -944,6 +952,8 @@ class UpdateCommentUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin, MockRe ...@@ -944,6 +952,8 @@ class UpdateCommentUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin, MockRe
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE) @override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class CreateSubCommentUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin, MockRequestSetupMixin): class CreateSubCommentUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin, MockRequestSetupMixin):
def setUp(self): def setUp(self):
super(CreateSubCommentUnicodeTestCase, self).setUp()
self.course = CourseFactory.create() self.course = CourseFactory.create()
seed_permissions_roles(self.course.id) seed_permissions_roles(self.course.id)
self.student = UserFactory.create() self.student = UserFactory.create()
...@@ -978,6 +988,8 @@ class UsersEndpointTestCase(ModuleStoreTestCase, MockRequestSetupMixin): ...@@ -978,6 +988,8 @@ class UsersEndpointTestCase(ModuleStoreTestCase, MockRequestSetupMixin):
}) })
def setUp(self): def setUp(self):
super(UsersEndpointTestCase, self).setUp()
self.course = CourseFactory.create() self.course = CourseFactory.create()
seed_permissions_roles(self.course.id) seed_permissions_roles(self.course.id)
self.student = UserFactory.create() self.student = UserFactory.create()
......
...@@ -186,6 +186,8 @@ class PartialDictMatcher(object): ...@@ -186,6 +186,8 @@ class PartialDictMatcher(object):
@patch('requests.request') @patch('requests.request')
class SingleThreadTestCase(ModuleStoreTestCase): class SingleThreadTestCase(ModuleStoreTestCase):
def setUp(self): def setUp(self):
super(SingleThreadTestCase, self).setUp(create_user=False)
self.course = CourseFactory.create() self.course = CourseFactory.create()
self.student = UserFactory.create() self.student = UserFactory.create()
CourseEnrollmentFactory.create(user=self.student, course_id=self.course.id) CourseEnrollmentFactory.create(user=self.student, course_id=self.course.id)
...@@ -835,6 +837,8 @@ class FollowedThreadsDiscussionGroupIdTestCase(CohortedContentTestCase, Cohorted ...@@ -835,6 +837,8 @@ class FollowedThreadsDiscussionGroupIdTestCase(CohortedContentTestCase, Cohorted
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE) @override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class InlineDiscussionTestCase(ModuleStoreTestCase): class InlineDiscussionTestCase(ModuleStoreTestCase):
def setUp(self): def setUp(self):
super(InlineDiscussionTestCase, self).setUp()
self.course = CourseFactory.create(org="TestX", number="101", display_name="Test Course") self.course = CourseFactory.create(org="TestX", number="101", display_name="Test Course")
self.student = UserFactory.create() self.student = UserFactory.create()
CourseEnrollmentFactory(user=self.student, course_id=self.course.id) CourseEnrollmentFactory(user=self.student, course_id=self.course.id)
...@@ -870,6 +874,8 @@ class UserProfileTestCase(ModuleStoreTestCase): ...@@ -870,6 +874,8 @@ class UserProfileTestCase(ModuleStoreTestCase):
TEST_THREAD_ID = 'userprofile-test-thread-id' TEST_THREAD_ID = 'userprofile-test-thread-id'
def setUp(self): def setUp(self):
super(UserProfileTestCase, self).setUp()
self.course = CourseFactory.create() self.course = CourseFactory.create()
self.student = UserFactory.create() self.student = UserFactory.create()
self.profiled_user = UserFactory.create() self.profiled_user = UserFactory.create()
...@@ -979,6 +985,8 @@ class UserProfileTestCase(ModuleStoreTestCase): ...@@ -979,6 +985,8 @@ class UserProfileTestCase(ModuleStoreTestCase):
class CommentsServiceRequestHeadersTestCase(UrlResetMixin, ModuleStoreTestCase): class CommentsServiceRequestHeadersTestCase(UrlResetMixin, ModuleStoreTestCase):
@patch.dict("django.conf.settings.FEATURES", {"ENABLE_DISCUSSION_SERVICE": True}) @patch.dict("django.conf.settings.FEATURES", {"ENABLE_DISCUSSION_SERVICE": True})
def setUp(self): def setUp(self):
super(CommentsServiceRequestHeadersTestCase, self).setUp()
username = "foo" username = "foo"
password = "bar" password = "bar"
...@@ -1038,6 +1046,8 @@ class CommentsServiceRequestHeadersTestCase(UrlResetMixin, ModuleStoreTestCase): ...@@ -1038,6 +1046,8 @@ class CommentsServiceRequestHeadersTestCase(UrlResetMixin, ModuleStoreTestCase):
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE) @override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class InlineDiscussionUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin): class InlineDiscussionUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin):
def setUp(self): def setUp(self):
super(InlineDiscussionUnicodeTestCase, self).setUp()
self.course = CourseFactory.create() self.course = CourseFactory.create()
self.student = UserFactory.create() self.student = UserFactory.create()
CourseEnrollmentFactory(user=self.student, course_id=self.course.id) CourseEnrollmentFactory(user=self.student, course_id=self.course.id)
...@@ -1058,6 +1068,8 @@ class InlineDiscussionUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin): ...@@ -1058,6 +1068,8 @@ class InlineDiscussionUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin):
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE) @override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class ForumFormDiscussionUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin): class ForumFormDiscussionUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin):
def setUp(self): def setUp(self):
super(ForumFormDiscussionUnicodeTestCase, self).setUp()
self.course = CourseFactory.create() self.course = CourseFactory.create()
self.student = UserFactory.create() self.student = UserFactory.create()
CourseEnrollmentFactory(user=self.student, course_id=self.course.id) CourseEnrollmentFactory(user=self.student, course_id=self.course.id)
...@@ -1079,6 +1091,8 @@ class ForumFormDiscussionUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin): ...@@ -1079,6 +1091,8 @@ class ForumFormDiscussionUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin):
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE) @override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class ForumDiscussionSearchUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin): class ForumDiscussionSearchUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin):
def setUp(self): def setUp(self):
super(ForumDiscussionSearchUnicodeTestCase, self).setUp()
self.course = CourseFactory.create() self.course = CourseFactory.create()
self.student = UserFactory.create() self.student = UserFactory.create()
CourseEnrollmentFactory(user=self.student, course_id=self.course.id) CourseEnrollmentFactory(user=self.student, course_id=self.course.id)
...@@ -1104,6 +1118,8 @@ class ForumDiscussionSearchUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin ...@@ -1104,6 +1118,8 @@ class ForumDiscussionSearchUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE) @override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class SingleThreadUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin): class SingleThreadUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin):
def setUp(self): def setUp(self):
super(SingleThreadUnicodeTestCase, self).setUp()
self.course = CourseFactory.create() self.course = CourseFactory.create()
self.student = UserFactory.create() self.student = UserFactory.create()
CourseEnrollmentFactory(user=self.student, course_id=self.course.id) CourseEnrollmentFactory(user=self.student, course_id=self.course.id)
...@@ -1126,6 +1142,8 @@ class SingleThreadUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin): ...@@ -1126,6 +1142,8 @@ class SingleThreadUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin):
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE) @override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class UserProfileUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin): class UserProfileUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin):
def setUp(self): def setUp(self):
super(UserProfileUnicodeTestCase, self).setUp()
self.course = CourseFactory.create() self.course = CourseFactory.create()
self.student = UserFactory.create() self.student = UserFactory.create()
CourseEnrollmentFactory(user=self.student, course_id=self.course.id) CourseEnrollmentFactory(user=self.student, course_id=self.course.id)
...@@ -1147,6 +1165,8 @@ class UserProfileUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin): ...@@ -1147,6 +1165,8 @@ class UserProfileUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin):
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE) @override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class FollowedThreadsUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin): class FollowedThreadsUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin):
def setUp(self): def setUp(self):
super(FollowedThreadsUnicodeTestCase, self).setUp()
self.course = CourseFactory.create() self.course = CourseFactory.create()
self.student = UserFactory.create() self.student = UserFactory.create()
CourseEnrollmentFactory(user=self.student, course_id=self.course.id) CourseEnrollmentFactory(user=self.student, course_id=self.course.id)
......
...@@ -17,6 +17,7 @@ class PermissionsTestCase(TestCase): ...@@ -17,6 +17,7 @@ class PermissionsTestCase(TestCase):
return ''.join(random.choice(chars) for x in range(length)) return ''.join(random.choice(chars) for x in range(length))
def setUp(self): def setUp(self):
super(PermissionsTestCase, self).setUp()
self.course_id = "edX/toy/2012_Fall" self.course_id = "edX/toy/2012_Fall"
......
...@@ -13,6 +13,8 @@ class MockCommentServiceServerTest(unittest.TestCase): ...@@ -13,6 +13,8 @@ class MockCommentServiceServerTest(unittest.TestCase):
''' '''
def setUp(self): def setUp(self):
super(MockCommentServiceServerTest, self).setUp()
# This is a test of the test setup, # This is a test of the test setup,
# so it does not need to run as part of the unit test suite # so it does not need to run as part of the unit test suite
# You can re-enable it by commenting out the line below # You can re-enable it by commenting out the line below
......
...@@ -8,6 +8,7 @@ import django_comment_client.middleware as middleware ...@@ -8,6 +8,7 @@ import django_comment_client.middleware as middleware
class AjaxExceptionTestCase(TestCase): class AjaxExceptionTestCase(TestCase):
def setUp(self): def setUp(self):
super(AjaxExceptionTestCase, self).setUp()
self.a = middleware.AjaxExceptionMiddleware() self.a = middleware.AjaxExceptionMiddleware()
self.request1 = django.http.HttpRequest() self.request1 = django.http.HttpRequest()
self.request0 = django.http.HttpRequest() self.request0 = django.http.HttpRequest()
......
...@@ -16,6 +16,8 @@ class RoleClassTestCase(ModuleStoreTestCase): ...@@ -16,6 +16,8 @@ class RoleClassTestCase(ModuleStoreTestCase):
Tests for roles of the comment client service integration Tests for roles of the comment client service integration
""" """
def setUp(self): def setUp(self):
super(RoleClassTestCase, self).setUp()
# For course ID, syntax edx/classname/classdate is important # For course ID, syntax edx/classname/classdate is important
# because xmodel.course_module.id_to_location looks for a string to split # because xmodel.course_module.id_to_location looks for a string to split
...@@ -57,6 +59,7 @@ class PermissionClassTestCase(TestCase): ...@@ -57,6 +59,7 @@ class PermissionClassTestCase(TestCase):
Tests for permissions of the comment client service integration Tests for permissions of the comment client service integration
""" """
def setUp(self): def setUp(self):
super(PermissionClassTestCase, self).setUp()
self.permission = models.Permission.objects.get_or_create(name="test")[0] self.permission = models.Permission.objects.get_or_create(name="test")[0]
def test_unicode(self): def test_unicode(self):
......
...@@ -4,6 +4,7 @@ import django_comment_client.mustache_helpers as mustache_helpers ...@@ -4,6 +4,7 @@ import django_comment_client.mustache_helpers as mustache_helpers
class PluralizeTest(TestCase): class PluralizeTest(TestCase):
def setUp(self): def setUp(self):
super(PluralizeTest, self).setUp()
self.text1 = '0 goat' self.text1 = '0 goat'
self.text2 = '1 goat' self.text2 = '1 goat'
self.text3 = '7 goat' self.text3 = '7 goat'
...@@ -17,6 +18,7 @@ class PluralizeTest(TestCase): ...@@ -17,6 +18,7 @@ class PluralizeTest(TestCase):
class CloseThreadTextTest(TestCase): class CloseThreadTextTest(TestCase):
def setUp(self): def setUp(self):
super(CloseThreadTextTest, self).setUp()
self.contentClosed = {'closed': True} self.contentClosed = {'closed': True}
self.contentOpen = {'closed': False} self.contentOpen = {'closed': False}
......
...@@ -49,6 +49,8 @@ class AccessUtilsTestCase(ModuleStoreTestCase): ...@@ -49,6 +49,8 @@ class AccessUtilsTestCase(ModuleStoreTestCase):
comment client service integration comment client service integration
""" """
def setUp(self): def setUp(self):
super(AccessUtilsTestCase, self).setUp(create_user=False)
self.course = CourseFactory.create() self.course = CourseFactory.create()
self.course_id = self.course.id self.course_id = self.course.id
self.student_role = RoleFactory(name='Student', course_id=self.course_id) self.student_role = RoleFactory(name='Student', course_id=self.course_id)
...@@ -90,6 +92,8 @@ class CoursewareContextTestCase(ModuleStoreTestCase): ...@@ -90,6 +92,8 @@ class CoursewareContextTestCase(ModuleStoreTestCase):
comment client service integration comment client service integration
""" """
def setUp(self): def setUp(self):
super(CoursewareContextTestCase, self).setUp()
self.course = CourseFactory.create(org="TestX", number="101", display_name="Test Course") self.course = CourseFactory.create(org="TestX", number="101", display_name="Test Course")
self.discussion1 = ItemFactory.create( self.discussion1 = ItemFactory.create(
parent_location=self.course.location, parent_location=self.course.location,
...@@ -151,6 +155,8 @@ class CategoryMapTestCase(ModuleStoreTestCase): ...@@ -151,6 +155,8 @@ class CategoryMapTestCase(ModuleStoreTestCase):
comment client service integration comment client service integration
""" """
def setUp(self): def setUp(self):
super(CategoryMapTestCase, self).setUp()
self.course = CourseFactory.create( self.course = CourseFactory.create(
org="TestX", number="101", display_name="Test Course", org="TestX", number="101", display_name="Test Course",
# This test needs to use a course that has already started -- # This test needs to use a course that has already started --
......
...@@ -62,6 +62,8 @@ class EdxNotesDecoratorTest(TestCase): ...@@ -62,6 +62,8 @@ class EdxNotesDecoratorTest(TestCase):
""" """
def setUp(self): def setUp(self):
super(EdxNotesDecoratorTest, self).setUp()
ClientFactory(name="edx-notes") ClientFactory(name="edx-notes")
self.course = CourseFactory.create(edxnotes=True) self.course = CourseFactory.create(edxnotes=True)
self.user = UserFactory.create(username="Bob", email="bob@example.com", password="edx") self.user = UserFactory.create(username="Bob", email="bob@example.com", password="edx")
......
...@@ -22,6 +22,8 @@ log = logging.getLogger(__name__) ...@@ -22,6 +22,8 @@ log = logging.getLogger(__name__)
class FolditTestCase(TestCase): class FolditTestCase(TestCase):
"""Tests for various responses of the FoldIt module""" """Tests for various responses of the FoldIt module"""
def setUp(self): def setUp(self):
super(FolditTestCase, self).setUp()
self.factory = RequestFactory() self.factory = RequestFactory()
self.url = reverse('foldit_ops') self.url = reverse('foldit_ops')
......
...@@ -34,6 +34,7 @@ class OpenEndedPostTest(ModuleStoreTestCase): ...@@ -34,6 +34,7 @@ class OpenEndedPostTest(ModuleStoreTestCase):
"""Test the openended_post management command.""" """Test the openended_post management command."""
def setUp(self): def setUp(self):
super(OpenEndedPostTest, self).setUp()
self.user = UserFactory() self.user = UserFactory()
store = modulestore() store = modulestore()
course_items = import_from_xml(store, self.user.id, TEST_DATA_DIR, ['open_ended']) # pylint: disable=maybe-no-member course_items = import_from_xml(store, self.user.id, TEST_DATA_DIR, ['open_ended']) # pylint: disable=maybe-no-member
...@@ -135,6 +136,8 @@ class OpenEndedStatsTest(ModuleStoreTestCase): ...@@ -135,6 +136,8 @@ class OpenEndedStatsTest(ModuleStoreTestCase):
"""Test the openended_stats management command.""" """Test the openended_stats management command."""
def setUp(self): def setUp(self):
super(OpenEndedStatsTest, self).setUp()
self.user = UserFactory() self.user = UserFactory()
store = modulestore() store = modulestore()
course_items = import_from_xml(store, self.user.id, TEST_DATA_DIR, ['open_ended']) # pylint: disable=maybe-no-member course_items = import_from_xml(store, self.user.id, TEST_DATA_DIR, ['open_ended']) # pylint: disable=maybe-no-member
......
...@@ -23,6 +23,8 @@ from instructor.access import (allow_access, ...@@ -23,6 +23,8 @@ from instructor.access import (allow_access,
class TestInstructorAccessList(ModuleStoreTestCase): class TestInstructorAccessList(ModuleStoreTestCase):
""" Test access listings. """ """ Test access listings. """
def setUp(self): def setUp(self):
super(TestInstructorAccessList, self).setUp()
self.course = CourseFactory.create() self.course = CourseFactory.create()
self.instructors = [UserFactory.create() for _ in xrange(4)] self.instructors = [UserFactory.create() for _ in xrange(4)]
...@@ -45,6 +47,8 @@ class TestInstructorAccessList(ModuleStoreTestCase): ...@@ -45,6 +47,8 @@ class TestInstructorAccessList(ModuleStoreTestCase):
class TestInstructorAccessAllow(ModuleStoreTestCase): class TestInstructorAccessAllow(ModuleStoreTestCase):
""" Test access allow. """ """ Test access allow. """
def setUp(self): def setUp(self):
super(TestInstructorAccessAllow, self).setUp()
self.course = CourseFactory.create() self.course = CourseFactory.create()
def test_allow(self): def test_allow(self):
...@@ -79,6 +83,8 @@ class TestInstructorAccessAllow(ModuleStoreTestCase): ...@@ -79,6 +83,8 @@ class TestInstructorAccessAllow(ModuleStoreTestCase):
class TestInstructorAccessRevoke(ModuleStoreTestCase): class TestInstructorAccessRevoke(ModuleStoreTestCase):
""" Test access revoke. """ """ Test access revoke. """
def setUp(self): def setUp(self):
super(TestInstructorAccessRevoke, self).setUp()
self.course = CourseFactory.create() self.course = CourseFactory.create()
self.staff = [UserFactory.create() for _ in xrange(4)] self.staff = [UserFactory.create() for _ in xrange(4)]
...@@ -115,6 +121,8 @@ class TestInstructorAccessForum(ModuleStoreTestCase): ...@@ -115,6 +121,8 @@ class TestInstructorAccessForum(ModuleStoreTestCase):
Test forum access control. Test forum access control.
""" """
def setUp(self): def setUp(self):
super(TestInstructorAccessForum, self).setUp()
self.course = CourseFactory.create() self.course = CourseFactory.create()
self.mod_role = Role.objects.create( self.mod_role = Role.objects.create(
......
...@@ -109,6 +109,7 @@ class TestCommonExceptions400(TestCase): ...@@ -109,6 +109,7 @@ class TestCommonExceptions400(TestCase):
""" """
def setUp(self): def setUp(self):
super(TestCommonExceptions400, self).setUp()
self.request = Mock(spec=HttpRequest) self.request = Mock(spec=HttpRequest)
self.request.META = {} self.request.META = {}
...@@ -152,6 +153,7 @@ class TestInstructorAPIDenyLevels(ModuleStoreTestCase, LoginEnrollmentTestCase): ...@@ -152,6 +153,7 @@ class TestInstructorAPIDenyLevels(ModuleStoreTestCase, LoginEnrollmentTestCase):
""" """
def setUp(self): def setUp(self):
super(TestInstructorAPIDenyLevels, self).setUp()
self.course = CourseFactory.create() self.course = CourseFactory.create()
self.user = UserFactory.create() self.user = UserFactory.create()
CourseEnrollment.enroll(self.user, self.course.id) CourseEnrollment.enroll(self.user, self.course.id)
...@@ -306,6 +308,8 @@ class TestInstructorAPIBulkAccountCreationAndEnrollment(ModuleStoreTestCase, Log ...@@ -306,6 +308,8 @@ class TestInstructorAPIBulkAccountCreationAndEnrollment(ModuleStoreTestCase, Log
Test Bulk account creation and enrollment from csv file Test Bulk account creation and enrollment from csv file
""" """
def setUp(self): def setUp(self):
super(TestInstructorAPIBulkAccountCreationAndEnrollment, self).setUp()
self.request = RequestFactory().request() self.request = RequestFactory().request()
self.course = CourseFactory.create() self.course = CourseFactory.create()
self.instructor = InstructorFactory(course_key=self.course.id) self.instructor = InstructorFactory(course_key=self.course.id)
...@@ -557,6 +561,8 @@ class TestInstructorAPIEnrollment(ModuleStoreTestCase, LoginEnrollmentTestCase): ...@@ -557,6 +561,8 @@ class TestInstructorAPIEnrollment(ModuleStoreTestCase, LoginEnrollmentTestCase):
""" """
def setUp(self): def setUp(self):
super(TestInstructorAPIEnrollment, self).setUp()
self.request = RequestFactory().request() self.request = RequestFactory().request()
self.course = CourseFactory.create() self.course = CourseFactory.create()
self.instructor = InstructorFactory(course_key=self.course.id) self.instructor = InstructorFactory(course_key=self.course.id)
...@@ -1140,6 +1146,8 @@ class TestInstructorAPIBulkBetaEnrollment(ModuleStoreTestCase, LoginEnrollmentTe ...@@ -1140,6 +1146,8 @@ class TestInstructorAPIBulkBetaEnrollment(ModuleStoreTestCase, LoginEnrollmentTe
""" """
def setUp(self): def setUp(self):
super(TestInstructorAPIBulkBetaEnrollment, self).setUp()
self.course = CourseFactory.create() self.course = CourseFactory.create()
self.instructor = InstructorFactory(course_key=self.course.id) self.instructor = InstructorFactory(course_key=self.course.id)
self.client.login(username=self.instructor.username, password='test') self.client.login(username=self.instructor.username, password='test')
...@@ -1460,6 +1468,8 @@ class TestInstructorAPILevelsAccess(ModuleStoreTestCase, LoginEnrollmentTestCase ...@@ -1460,6 +1468,8 @@ class TestInstructorAPILevelsAccess(ModuleStoreTestCase, LoginEnrollmentTestCase
""" """
def setUp(self): def setUp(self):
super(TestInstructorAPILevelsAccess, self).setUp()
self.course = CourseFactory.create() self.course = CourseFactory.create()
self.instructor = InstructorFactory(course_key=self.course.id) self.instructor = InstructorFactory(course_key=self.course.id)
self.client.login(username=self.instructor.username, password='test') self.client.login(username=self.instructor.username, password='test')
...@@ -2158,6 +2168,7 @@ class TestInstructorAPIRegradeTask(ModuleStoreTestCase, LoginEnrollmentTestCase) ...@@ -2158,6 +2168,7 @@ class TestInstructorAPIRegradeTask(ModuleStoreTestCase, LoginEnrollmentTestCase)
""" """
def setUp(self): def setUp(self):
super(TestInstructorAPIRegradeTask, self).setUp()
self.course = CourseFactory.create() self.course = CourseFactory.create()
self.instructor = InstructorFactory(course_key=self.course.id) self.instructor = InstructorFactory(course_key=self.course.id)
self.client.login(username=self.instructor.username, password='test') self.client.login(username=self.instructor.username, password='test')
...@@ -2298,6 +2309,8 @@ class TestInstructorSendEmail(ModuleStoreTestCase, LoginEnrollmentTestCase): ...@@ -2298,6 +2309,8 @@ class TestInstructorSendEmail(ModuleStoreTestCase, LoginEnrollmentTestCase):
""" """
def setUp(self): def setUp(self):
super(TestInstructorSendEmail, self).setUp()
self.course = CourseFactory.create() self.course = CourseFactory.create()
self.instructor = InstructorFactory(course_key=self.course.id) self.instructor = InstructorFactory(course_key=self.course.id)
self.client.login(username=self.instructor.username, password='test') self.client.login(username=self.instructor.username, password='test')
...@@ -2420,6 +2433,8 @@ class TestInstructorAPITaskLists(ModuleStoreTestCase, LoginEnrollmentTestCase): ...@@ -2420,6 +2433,8 @@ class TestInstructorAPITaskLists(ModuleStoreTestCase, LoginEnrollmentTestCase):
return attr_dict return attr_dict
def setUp(self): def setUp(self):
super(TestInstructorAPITaskLists, self).setUp()
self.course = CourseFactory.create() self.course = CourseFactory.create()
self.instructor = InstructorFactory(course_key=self.course.id) self.instructor = InstructorFactory(course_key=self.course.id)
self.client.login(username=self.instructor.username, password='test') self.client.login(username=self.instructor.username, password='test')
...@@ -2540,6 +2555,8 @@ class TestInstructorEmailContentList(ModuleStoreTestCase, LoginEnrollmentTestCas ...@@ -2540,6 +2555,8 @@ class TestInstructorEmailContentList(ModuleStoreTestCase, LoginEnrollmentTestCas
""" """
def setUp(self): def setUp(self):
super(TestInstructorEmailContentList, self).setUp()
self.course = CourseFactory.create() self.course = CourseFactory.create()
self.instructor = InstructorFactory(course_key=self.course.id) self.instructor = InstructorFactory(course_key=self.course.id)
self.client.login(username=self.instructor.username, password='test') self.client.login(username=self.instructor.username, password='test')
...@@ -2691,6 +2708,8 @@ class TestInstructorAPIAnalyticsProxy(ModuleStoreTestCase, LoginEnrollmentTestCa ...@@ -2691,6 +2708,8 @@ class TestInstructorAPIAnalyticsProxy(ModuleStoreTestCase, LoginEnrollmentTestCa
self.content = '{"test_content": "robot test content"}' self.content = '{"test_content": "robot test content"}'
def setUp(self): def setUp(self):
super(TestInstructorAPIAnalyticsProxy, self).setUp()
self.course = CourseFactory.create() self.course = CourseFactory.create()
self.instructor = InstructorFactory(course_key=self.course.id) self.instructor = InstructorFactory(course_key=self.course.id)
self.client.login(username=self.instructor.username, password='test') self.client.login(username=self.instructor.username, password='test')
...@@ -3050,6 +3069,8 @@ class TestCourseRegistrationCodes(ModuleStoreTestCase): ...@@ -3050,6 +3069,8 @@ class TestCourseRegistrationCodes(ModuleStoreTestCase):
""" """
Fixtures. Fixtures.
""" """
super(TestCourseRegistrationCodes, self).setUp()
self.course = CourseFactory.create() self.course = CourseFactory.create()
CourseModeFactory.create(course_id=self.course.id, min_price=50) CourseModeFactory.create(course_id=self.course.id, min_price=50)
self.instructor = InstructorFactory(course_key=self.course.id) self.instructor = InstructorFactory(course_key=self.course.id)
......
...@@ -22,6 +22,8 @@ class TestInstructorAPIEnrollmentEmailLocalization(TestCase): ...@@ -22,6 +22,8 @@ class TestInstructorAPIEnrollmentEmailLocalization(TestCase):
""" """
def setUp(self): def setUp(self):
super(TestInstructorAPIEnrollmentEmailLocalization, self).setUp()
# Platform language is English, instructor's language is Chinese, # Platform language is English, instructor's language is Chinese,
# student's language is French, so the emails should all be sent in # student's language is French, so the emails should all be sent in
# French. # French.
......
...@@ -23,6 +23,7 @@ class TestECommerceDashboardViews(ModuleStoreTestCase): ...@@ -23,6 +23,7 @@ class TestECommerceDashboardViews(ModuleStoreTestCase):
Check for E-commerce view on the new instructor dashboard Check for E-commerce view on the new instructor dashboard
""" """
def setUp(self): def setUp(self):
super(TestECommerceDashboardViews, self).setUp()
self.course = CourseFactory.create() self.course = CourseFactory.create()
# Create instructor account # Create instructor account
......
...@@ -11,9 +11,8 @@ from mock import patch ...@@ -11,9 +11,8 @@ from mock import patch
from opaque_keys.edx.locations import SlashSeparatedCourseKey from opaque_keys.edx.locations import SlashSeparatedCourseKey
from bulk_email.models import CourseAuthorization from bulk_email.models import CourseAuthorization
from xmodule.modulestore.tests.django_utils import TEST_DATA_MOCK_MODULESTORE from xmodule.modulestore.tests.django_utils import TEST_DATA_MIXED_TOY_MODULESTORE, ModuleStoreTestCase
from student.tests.factories import AdminFactory from student.tests.factories import AdminFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory from xmodule.modulestore.tests.factories import CourseFactory
...@@ -24,6 +23,7 @@ class TestNewInstructorDashboardEmailViewMongoBacked(ModuleStoreTestCase): ...@@ -24,6 +23,7 @@ class TestNewInstructorDashboardEmailViewMongoBacked(ModuleStoreTestCase):
for Mongo-backed courses for Mongo-backed courses
""" """
def setUp(self): def setUp(self):
super(TestNewInstructorDashboardEmailViewMongoBacked, self).setUp()
self.course = CourseFactory.create() self.course = CourseFactory.create()
# Create instructor account # Create instructor account
...@@ -111,7 +111,11 @@ class TestNewInstructorDashboardEmailViewXMLBacked(ModuleStoreTestCase): ...@@ -111,7 +111,11 @@ class TestNewInstructorDashboardEmailViewXMLBacked(ModuleStoreTestCase):
""" """
Check for email view on the new instructor dashboard Check for email view on the new instructor dashboard
""" """
MODULESTORE = TEST_DATA_MIXED_TOY_MODULESTORE
def setUp(self): def setUp(self):
super(TestNewInstructorDashboardEmailViewXMLBacked, self).setUp()
self.course_key = SlashSeparatedCourseKey('edX', 'toy', '2012_Fall') self.course_key = SlashSeparatedCourseKey('edX', 'toy', '2012_Fall')
# Create instructor account # Create instructor account
......
...@@ -36,6 +36,7 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase ...@@ -36,6 +36,7 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
class TestSettableEnrollmentState(TestCase): class TestSettableEnrollmentState(TestCase):
""" Test the basis class for enrollment tests. """ """ Test the basis class for enrollment tests. """
def setUp(self): def setUp(self):
super(TestSettableEnrollmentState, self).setUp()
self.course_key = SlashSeparatedCourseKey('Robot', 'fAKE', 'C-%-se-%-ID') self.course_key = SlashSeparatedCourseKey('Robot', 'fAKE', 'C-%-se-%-ID')
def test_mes_create(self): def test_mes_create(self):
...@@ -66,6 +67,7 @@ class TestEnrollmentChangeBase(TestCase): ...@@ -66,6 +67,7 @@ class TestEnrollmentChangeBase(TestCase):
__metaclass__ = ABCMeta __metaclass__ = ABCMeta
def setUp(self): def setUp(self):
super(TestEnrollmentChangeBase, self).setUp()
self.course_key = SlashSeparatedCourseKey('Robot', 'fAKE', 'C-%-se-%-ID') self.course_key = SlashSeparatedCourseKey('Robot', 'fAKE', 'C-%-se-%-ID')
def _run_state_change_test(self, before_ideal, after_ideal, action): def _run_state_change_test(self, before_ideal, after_ideal, action):
...@@ -294,6 +296,7 @@ class TestInstructorUnenrollDB(TestEnrollmentChangeBase): ...@@ -294,6 +296,7 @@ class TestInstructorUnenrollDB(TestEnrollmentChangeBase):
class TestInstructorEnrollmentStudentModule(TestCase): class TestInstructorEnrollmentStudentModule(TestCase):
""" Test student module manipulations. """ """ Test student module manipulations. """
def setUp(self): def setUp(self):
super(TestInstructorEnrollmentStudentModule, self).setUp()
self.course_key = SlashSeparatedCourseKey('fake', 'course', 'id') self.course_key = SlashSeparatedCourseKey('fake', 'course', 'id')
def test_reset_student_attempts(self): def test_reset_student_attempts(self):
...@@ -425,6 +428,7 @@ class TestSendBetaRoleEmail(TestCase): ...@@ -425,6 +428,7 @@ class TestSendBetaRoleEmail(TestCase):
""" """
def setUp(self): def setUp(self):
super(TestSendBetaRoleEmail, self).setUp()
self.user = UserFactory.create() self.user = UserFactory.create()
self.email_params = {'course': 'Robot Super Course'} self.email_params = {'course': 'Robot Super Course'}
...@@ -442,6 +446,8 @@ class TestGetEmailParams(ModuleStoreTestCase): ...@@ -442,6 +446,8 @@ class TestGetEmailParams(ModuleStoreTestCase):
production-like conditions. production-like conditions.
""" """
def setUp(self): def setUp(self):
super(TestGetEmailParams, self).setUp()
self.course = CourseFactory.create() self.course = CourseFactory.create()
# Explicitly construct what we expect the course URLs to be # Explicitly construct what we expect the course URLs to be
...@@ -484,6 +490,7 @@ class TestRenderMessageToString(TestCase): ...@@ -484,6 +490,7 @@ class TestRenderMessageToString(TestCase):
""" """
def setUp(self): def setUp(self):
super(TestRenderMessageToString, self).setUp()
self.subject_template = 'emails/enroll_email_allowedsubject.txt' self.subject_template = 'emails/enroll_email_allowedsubject.txt'
self.message_template = 'emails/enroll_email_allowedmessage.txt' self.message_template = 'emails/enroll_email_allowedmessage.txt'
self.course = CourseFactory.create() self.course = CourseFactory.create()
......
...@@ -23,6 +23,8 @@ class HintManagerTest(ModuleStoreTestCase): ...@@ -23,6 +23,8 @@ class HintManagerTest(ModuleStoreTestCase):
Makes a course, which will be the same for all tests. Makes a course, which will be the same for all tests.
Set up mako middleware, which is necessary for template rendering to happen. Set up mako middleware, which is necessary for template rendering to happen.
""" """
super(HintManagerTest, self).setUp()
self.course = CourseFactory.create(org='Me', number='19.002', display_name='test_course') self.course = CourseFactory.create(org='Me', number='19.002', display_name='test_course')
self.url = '/courses/Me/19.002/test_course/hint_manager' self.url = '/courses/Me/19.002/test_course/hint_manager'
self.user = UserFactory.create(username='robot', email='robot@edx.org', password='test', is_staff=True) self.user = UserFactory.create(username='robot', email='robot@edx.org', password='test', is_staff=True)
......
...@@ -29,6 +29,7 @@ class TestInstructorEnrollsStudent(ModuleStoreTestCase, LoginEnrollmentTestCase) ...@@ -29,6 +29,7 @@ class TestInstructorEnrollsStudent(ModuleStoreTestCase, LoginEnrollmentTestCase)
""" """
def setUp(self): def setUp(self):
super(TestInstructorEnrollsStudent, self).setUp()
instructor = AdminFactory.create() instructor = AdminFactory.create()
self.client.login(username=instructor.username, password='test') self.client.login(username=instructor.username, password='test')
......
...@@ -21,6 +21,8 @@ from instructor.views import legacy ...@@ -21,6 +21,8 @@ from instructor.views import legacy
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE) @override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class TestXss(ModuleStoreTestCase): class TestXss(ModuleStoreTestCase):
def setUp(self): def setUp(self):
super(TestXss, self).setUp()
self._request_factory = RequestFactory() self._request_factory = RequestFactory()
self._course = CourseFactory.create() self._course = CourseFactory.create()
self._evil_student = UserFactory.create( self._evil_student = UserFactory.create(
......
...@@ -26,6 +26,8 @@ class TestGradebook(ModuleStoreTestCase): ...@@ -26,6 +26,8 @@ class TestGradebook(ModuleStoreTestCase):
grading_policy = None grading_policy = None
def setUp(self): def setUp(self):
super(TestGradebook, self).setUp()
instructor = AdminFactory.create() instructor = AdminFactory.create()
self.client.login(username=instructor.username, password='test') self.client.login(username=instructor.username, password='test')
......
...@@ -70,6 +70,7 @@ class TestRequireStudentIdentifier(unittest.TestCase): ...@@ -70,6 +70,7 @@ class TestRequireStudentIdentifier(unittest.TestCase):
""" """
Fixtures Fixtures
""" """
super(TestRequireStudentIdentifier, self).setUp()
self.student = UserFactory.create() self.student = UserFactory.create()
def test_valid_student_id(self): def test_valid_student_id(self):
...@@ -107,6 +108,8 @@ class TestFindUnit(ModuleStoreTestCase): ...@@ -107,6 +108,8 @@ class TestFindUnit(ModuleStoreTestCase):
""" """
Fixtures. Fixtures.
""" """
super(TestFindUnit, self).setUp()
course = CourseFactory.create() course = CourseFactory.create()
week1 = ItemFactory.create(parent=course) week1 = ItemFactory.create(parent=course)
homework = ItemFactory.create(parent=week1) homework = ItemFactory.create(parent=week1)
...@@ -140,6 +143,8 @@ class TestGetUnitsWithDueDate(ModuleStoreTestCase): ...@@ -140,6 +143,8 @@ class TestGetUnitsWithDueDate(ModuleStoreTestCase):
""" """
Fixtures. Fixtures.
""" """
super(TestGetUnitsWithDueDate, self).setUp()
due = datetime.datetime(2010, 5, 12, 2, 42, tzinfo=utc) due = datetime.datetime(2010, 5, 12, 2, 42, tzinfo=utc)
course = CourseFactory.create() course = CourseFactory.create()
week1 = ItemFactory.create(due=due, parent=course) week1 = ItemFactory.create(due=due, parent=course)
...@@ -188,6 +193,8 @@ class TestSetDueDateExtension(ModuleStoreTestCase): ...@@ -188,6 +193,8 @@ class TestSetDueDateExtension(ModuleStoreTestCase):
""" """
Fixtures. Fixtures.
""" """
super(TestSetDueDateExtension, self).setUp()
due = datetime.datetime(2010, 5, 12, 2, 42, tzinfo=utc) due = datetime.datetime(2010, 5, 12, 2, 42, tzinfo=utc)
course = CourseFactory.create() course = CourseFactory.create()
week1 = ItemFactory.create(due=due, parent=course) week1 = ItemFactory.create(due=due, parent=course)
...@@ -263,6 +270,8 @@ class TestDataDumps(ModuleStoreTestCase): ...@@ -263,6 +270,8 @@ class TestDataDumps(ModuleStoreTestCase):
""" """
Fixtures. Fixtures.
""" """
super(TestDataDumps, self).setUp()
due = datetime.datetime(2010, 5, 12, 2, 42, tzinfo=utc) due = datetime.datetime(2010, 5, 12, 2, 42, tzinfo=utc)
course = CourseFactory.create() course = CourseFactory.create()
week1 = ItemFactory.create(due=due, parent=course) week1 = ItemFactory.create(due=due, parent=course)
......
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