diff --git a/cms/djangoapps/contentstore/tests/tests.py b/cms/djangoapps/contentstore/tests/tests.py
index 0727cb6..f41492a 100644
--- a/cms/djangoapps/contentstore/tests/tests.py
+++ b/cms/djangoapps/contentstore/tests/tests.py
@@ -29,6 +29,7 @@ from xmodule.course_module import CourseDescriptor
 from xmodule.seq_module import SequenceDescriptor
 
 from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
+from .utils import CmsTestCase
 
 def parse_json(response):
     """Parse response, which is assumed to be json"""
@@ -196,7 +197,7 @@ TEST_DATA_MODULESTORE['default']['OPTIONS']['fs_root'] = path('common/test/data'
 TEST_DATA_MODULESTORE['direct']['OPTIONS']['fs_root'] = path('common/test/data')
 
 @override_settings(MODULESTORE=TEST_DATA_MODULESTORE)
-class ContentStoreTest(TestCase):
+class ContentStoreTest(CmsTestCase):
 
     def setUp(self):
         uname = 'testuser'
@@ -213,17 +214,6 @@ class ContentStoreTest(TestCase):
         self.user.is_staff = True
         self.user.save()
 
-        # Flush and initialize the module store
-        # It needs the templates because it creates new records
-        # by cloning from the template.
-        # Note that if your test module gets in some weird state
-        # (though it shouldn't), do this manually
-        # from the bash shell to drop it:
-        # $ mongo test_xmodule --eval "db.dropDatabase()"
-        _MODULESTORES = {}
-        modulestore().collection.drop()
-        update_templates()
-
         self.client = Client()
         self.client.login(username=uname, password=password)
 
@@ -234,15 +224,6 @@ class ContentStoreTest(TestCase):
             'display_name': 'Robot Super Course',
             }
 
-    def tearDown(self):
-        # Make sure you flush out the test modulestore after the end
-        # of the last test because otherwise on the next run
-        # cms/djangoapps/contentstore/__init__.py
-        # update_templates() will try to update the templates
-        # via upsert and it sometimes seems to be messing things up.
-        _MODULESTORES = {}
-        modulestore().collection.drop()
-
     def test_create_course(self):
         """Test new course creation - happy path"""
         resp = self.client.post(reverse('create_new_course'), self.course_data)
diff --git a/cms/djangoapps/contentstore/tests/utils.py b/cms/djangoapps/contentstore/tests/utils.py
new file mode 100644
index 0000000..c800ee9
--- /dev/null
+++ b/cms/djangoapps/contentstore/tests/utils.py
@@ -0,0 +1,32 @@
+from django.test import TestCase
+from xmodule.modulestore.django import modulestore, _MODULESTORES
+from xmodule.templates import update_templates
+
+# Subclass TestCase and use to initialize the contentstore
+class CmsTestCase(TestCase):
+    """ Subclass for any test case that uses the mongodb 
+    module store. This clears it out before running the TestCase
+    and reinitilizes it with the templates afterwards. """
+
+    def _pre_setup(self):
+        super(CmsTestCase, self)._pre_setup()        
+        # Flush and initialize the module store
+        # It needs the templates because it creates new records
+        # by cloning from the template.
+        # Note that if your test module gets in some weird state
+        # (though it shouldn't), do this manually
+        # from the bash shell to drop it:
+        # $ mongo test_xmodule --eval "db.dropDatabase()"
+        _MODULESTORES = {}
+        modulestore().collection.drop()
+        update_templates()
+
+    def _post_teardown(self):
+        # Make sure you flush out the test modulestore after the end
+        # of the last test because otherwise on the next run
+        # cms/djangoapps/contentstore/__init__.py
+        # update_templates() will try to update the templates
+        # via upsert and it sometimes seems to be messing things up.
+        _MODULESTORES = {}
+        modulestore().collection.drop()
+        super(CmsTestCase, self)._post_teardown()
\ No newline at end of file