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