Remove django test environment setup code.
[htsworkflow.git] / htsworkflow / frontend / experiments / test_experiments.py
index 8eb998343b7409350554a169c5a9cbc1748b96f6..11214b1163ad4fb2a4b6a7de1879cc8095847a97 100644 (file)
@@ -15,6 +15,8 @@ from django.core import mail
 from django.core.exceptions import ObjectDoesNotExist
 from django.test import TestCase
 from django.test.utils import setup_test_environment, teardown_test_environment
+from django.db import connection
+from django.conf import settings
 from htsworkflow.frontend.experiments import models
 from htsworkflow.frontend.experiments import experiments
 from htsworkflow.frontend.auth import apidata
@@ -26,6 +28,8 @@ LANE_SET = range(1,9)
 
 NSMAP = {'libns':'http://jumpgate.caltech.edu/wiki/LibraryOntology#'}
 
+from django.db import connection
+
 class ClusterStationTestCases(TestCase):
     fixtures = ['test_flowcells.json']
 
@@ -480,10 +484,9 @@ class TestFileType(TestCase):
         file_type_objects = models.FileType.objects
         name = 'QSEQ tarfile'
         file_type_object = file_type_objects.get(name=name)
-        self.assertEqual(u"<FileType: QSEQ tarfile>",
+        self.assertEqual(u"QSEQ tarfile",
                              unicode(file_type_object))
 
-class TestFileType(TestCase):
     def test_find_file_type(self):
         file_type_objects = models.FileType.objects
         cases = [('woldlab_090921_HWUSI-EAS627_0009_42FC3AAXX_l7_r1.tar.bz2',
@@ -537,17 +540,6 @@ class TestFileType(TestCase):
 class TestEmailNotify(TestCase):
     fixtures = ['test_flowcells.json']
 
-    @classmethod
-    def setUpClass(self):
-        # isolate django mail when running under unittest2
-        setup_test_environment()
-
-    @classmethod
-    def tearDownClass(self):
-        # isolate django mail when running under unittest2
-        teardown_test_environment()
-
-
     def test_started_email_not_logged_in(self):
         response = self.client.get('/experiments/started/153/')
         self.assertEqual(response.status_code, 302)
@@ -684,3 +676,19 @@ class TestSequencer(TestCase):
 
         errmsgs = list(inference.run_validation())
         self.assertEqual(len(errmsgs), 0)
+
+def suite():
+    from unittest2 import TestSuite, defaultTestLoader
+    suite = TestSuite()
+    for testcase in [ClusterStationTestCases,
+                     SequencerTestCases,
+                     ExerimentsTestCases,
+                     TestFileType,
+                     TestEmailNotify,
+                     TestSequencer]:
+        suite.addTests(defaultTestLoader.loadTestsFromTestCase(testcase))
+    return suite
+
+if __name__ == "__main__":
+    from unittest2 import main
+    main(defaultTest="suite")