Commit 32000c7a by Jeremy Bowman

Clean up TestCase subclassing

parent f42e6f1c
""" """
Unittests for creating a course in an chosen modulestore Unittests for creating a course in an chosen modulestore
""" """
import unittest
import ddt import ddt
from django.core.management import CommandError, call_command from django.core.management import CommandError, call_command
from django.test import TestCase
from contentstore.management.commands.create_course import Command from contentstore.management.commands.create_course import Command
from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore import ModuleStoreEnum
...@@ -11,7 +11,7 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase ...@@ -11,7 +11,7 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.django import modulestore from xmodule.modulestore.django import modulestore
class TestArgParsing(unittest.TestCase): class TestArgParsing(TestCase):
""" """
Tests for parsing arguments for the `create_course` management command Tests for parsing arguments for the `create_course` management command
""" """
......
""" """
Unittests for migrating a course to split mongo Unittests for migrating a course to split mongo
""" """
import unittest
from django.core.management import CommandError, call_command from django.core.management import CommandError, call_command
from django.test import TestCase
from contentstore.management.commands.migrate_to_split import Command from contentstore.management.commands.migrate_to_split import Command
from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
...@@ -12,7 +11,7 @@ from xmodule.modulestore.django import modulestore ...@@ -12,7 +11,7 @@ from xmodule.modulestore.django import modulestore
from xmodule.modulestore.exceptions import ItemNotFoundError from xmodule.modulestore.exceptions import ItemNotFoundError
class TestArgParsing(unittest.TestCase): class TestArgParsing(TestCase):
""" """
Tests for parsing arguments for the `migrate_to_split` management command Tests for parsing arguments for the `migrate_to_split` management command
""" """
......
...@@ -78,7 +78,7 @@ class TestMongoModuleStoreBase(unittest.TestCase): ...@@ -78,7 +78,7 @@ class TestMongoModuleStoreBase(unittest.TestCase):
courses = ['toy', 'simple', 'simple_with_draft', 'test_unicode'] courses = ['toy', 'simple', 'simple_with_draft', 'test_unicode']
@classmethod @classmethod
def setupClass(cls): def setUpClass(cls):
cls.connection = pymongo.MongoClient( cls.connection = pymongo.MongoClient(
host=HOST, host=HOST,
port=PORT, port=PORT,
...@@ -93,7 +93,7 @@ class TestMongoModuleStoreBase(unittest.TestCase): ...@@ -93,7 +93,7 @@ class TestMongoModuleStoreBase(unittest.TestCase):
cls.content_store, cls.draft_store = cls.initdb() cls.content_store, cls.draft_store = cls.initdb()
@classmethod @classmethod
def teardownClass(cls): def tearDownClass(cls):
if cls.connection: if cls.connection:
cls.connection.drop_database(DB) cls.connection.drop_database(DB)
cls.connection.close() cls.connection.close()
...@@ -186,12 +186,12 @@ class TestMongoModuleStore(TestMongoModuleStoreBase): ...@@ -186,12 +186,12 @@ class TestMongoModuleStore(TestMongoModuleStoreBase):
pass pass
@classmethod @classmethod
def setupClass(cls): def setUpClass(cls):
super(TestMongoModuleStore, cls).setupClass() super(TestMongoModuleStore, cls).setUpClass()
@classmethod @classmethod
def teardownClass(cls): def tearDownClass(cls):
super(TestMongoModuleStore, cls).teardownClass() super(TestMongoModuleStore, cls).tearDownClass()
def test_init(self): def test_init(self):
'''Make sure the db loads''' '''Make sure the db loads'''
...@@ -728,12 +728,12 @@ class TestMongoModuleStoreWithNoAssetCollection(TestMongoModuleStore): ...@@ -728,12 +728,12 @@ class TestMongoModuleStoreWithNoAssetCollection(TestMongoModuleStore):
pass pass
@classmethod @classmethod
def setupClass(cls): def setUpClass(cls):
super(TestMongoModuleStoreWithNoAssetCollection, cls).setupClass() super(TestMongoModuleStoreWithNoAssetCollection, cls).setUpClass()
@classmethod @classmethod
def teardownClass(cls): def tearDownClass(cls):
super(TestMongoModuleStoreWithNoAssetCollection, cls).teardownClass() super(TestMongoModuleStoreWithNoAssetCollection, cls).tearDownClass()
def test_no_asset_collection(self): def test_no_asset_collection(self):
courses = self.draft_store.get_courses() courses = self.draft_store.get_courses()
......
""" """
Tests for block_structure_factory.py Tests for block_structure_factory.py
""" """
from django.test import TestCase
from nose.plugins.attrib import attr from nose.plugins.attrib import attr
from unittest import TestCase
from xmodule.modulestore.exceptions import ItemNotFoundError from xmodule.modulestore.exceptions import ItemNotFoundError
from ..store import BlockStructureStore from ..store import BlockStructureStore
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
Tests for manager.py Tests for manager.py
""" """
import ddt import ddt
from django.test import TestCase
from nose.plugins.attrib import attr from nose.plugins.attrib import attr
from unittest import TestCase
from ..block_structure import BlockStructureBlockData from ..block_structure import BlockStructureBlockData
from ..config import RAISE_ERROR_WHEN_NOT_FOUND, STORAGE_BACKING_FOR_CACHE, waffle from ..config import RAISE_ERROR_WHEN_NOT_FOUND, STORAGE_BACKING_FOR_CACHE, waffle
......
"""Tests for user API middleware""" """Tests for user API middleware"""
from mock import Mock, patch from mock import Mock, patch
from unittest import TestCase
from django.http import HttpResponse from django.http import HttpResponse
from django.test import TestCase
from django.test.client import RequestFactory from django.test.client import RequestFactory
from student.tests.factories import UserFactory, AnonymousUserFactory from student.tests.factories import UserFactory, AnonymousUserFactory
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
Test the user api's partition extensions. Test the user api's partition extensions.
""" """
from collections import defaultdict from collections import defaultdict
from django.test import TestCase
from mock import patch from mock import patch
from unittest import TestCase
from openedx.core.djangoapps.user_api.partition_schemes import RandomUserPartitionScheme, UserPartitionError from openedx.core.djangoapps.user_api.partition_schemes import RandomUserPartitionScheme, UserPartitionError
from student.tests.factories import UserFactory from student.tests.factories import UserFactory
......
...@@ -3,10 +3,9 @@ Unit tests for user messages. ...@@ -3,10 +3,9 @@ Unit tests for user messages.
""" """
import ddt import ddt
from unittest import TestCase
from django.contrib.messages.middleware import MessageMiddleware from django.contrib.messages.middleware import MessageMiddleware
from django.test import RequestFactory from django.test import RequestFactory, TestCase
from openedx.core.djangolib.markup import HTML, Text from openedx.core.djangolib.markup import HTML, Text
from student.tests.factories import UserFactory from student.tests.factories import UserFactory
......
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