Explicitly list initial_data.json for the test data loader fixtures
[htsworkflow.git] / htsworkflow / frontend / experiments / test_experiments.py
index 5878d726d7ee1d268382230a56a235aef7ca29e6..9cafb03d992004ec97b5f3cde31745cb4e7f73b0 100644 (file)
@@ -29,19 +29,10 @@ LANE_SET = range(1,9)
 NSMAP = {'libns':'http://jumpgate.caltech.edu/wiki/LibraryOntology#'}
 
 from django.db import connection
-OLD_DB_NAME = settings.DATABASE_NAME
-VERBOSITY = 0
-def setUpModule():
-    setup_test_environment()
-    settings.DEBUG = False
-    connection.creation.create_test_db(VERBOSITY)
-
-def tearDownModule():
-    connection.creation.destroy_test_db(OLD_DB_NAME, VERBOSITY)
-    teardown_test_environment()
 
 class ClusterStationTestCases(TestCase):
-    fixtures = ['test_flowcells.json']
+    fixtures = ['initial_data.json',
+                'test_flowcells.json']
 
     def test_default(self):
         c = models.ClusterStation.default()
@@ -89,7 +80,8 @@ class ClusterStationTestCases(TestCase):
 
 
 class SequencerTestCases(TestCase):
-    fixtures = ['test_flowcells.json']
+    fixtures = ['initial_data.json',
+                'test_flowcells.json']
 
     def test_default(self):
         # starting with no default
@@ -141,7 +133,8 @@ class SequencerTestCases(TestCase):
 
 
 class ExperimentsTestCases(TestCase):
-    fixtures = ['test_flowcells.json',
+    fixtures = ['initial_data.json',
+                'test_flowcells.json',
                 ]
 
     def setUp(self):
@@ -298,8 +291,8 @@ class ExperimentsTestCases(TestCase):
         tree = fromstring(response.content)
         flowcell_spans = tree.xpath('//span[@property="libns:flowcell_id"]',
                                     namespaces=NSMAP)
-        self.assertEqual(flowcell_spans[0].text, '30012AAXX (failed)')
-        failed_fc_span = flowcell_spans[0]
+        self.assertEqual(flowcell_spans[1].text, '30012AAXX (failed)')
+        failed_fc_span = flowcell_spans[1]
         failed_fc_a = failed_fc_span.getparent()
         # make sure some of our RDF made it.
         self.assertEqual(failed_fc_a.get('typeof'), 'libns:IlluminaFlowcell')
@@ -490,6 +483,10 @@ class ExperimentsTestCases(TestCase):
 
 
 class TestFileType(TestCase):
+    fixtures = ['initial_data.json',
+                'test_flowcells.json',
+                ]
+
     def test_file_type_unicode(self):
         file_type_objects = models.FileType.objects
         name = 'QSEQ tarfile'
@@ -548,7 +545,8 @@ class TestFileType(TestCase):
             self.assertEqual(result.get('end', None), end)
 
 class TestEmailNotify(TestCase):
-    fixtures = ['test_flowcells.json']
+    fixtures = ['initial_data.json',
+                'test_flowcells.json']
 
     def test_started_email_not_logged_in(self):
         response = self.client.get('/experiments/started/153/')
@@ -598,7 +596,8 @@ def multi_lane_to_dict(lane):
     return dict( ((x['library_id'],x) for x in lane) )
 
 class TestSequencer(TestCase):
-    fixtures = ['test_flowcells.json',
+    fixtures = ['initial_data.json',
+                'test_flowcells.json',
                 ]
 
     def test_name_generation(self):
@@ -687,16 +686,6 @@ class TestSequencer(TestCase):
         errmsgs = list(inference.run_validation())
         self.assertEqual(len(errmsgs), 0)
 
-
-OLD_DB = settings.DATABASES['default']['NAME']
-def setUpModule():
-    setup_test_environment()
-    connection.creation.create_test_db()
-
-def tearDownModule():
-    connection.creation.destroy_test_db(OLD_DB)
-    teardown_test_environment()
-
 def suite():
     from unittest2 import TestSuite, defaultTestLoader
     suite = TestSuite()