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
NSMAP = {'libns':'http://jumpgate.caltech.edu/wiki/LibraryOntology#'}
+from django.db import connection
+
class ClusterStationTestCases(TestCase):
fixtures = ['test_flowcells.json']
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',
response = self.client.get('/experiments/started/153/', {'send':'1','bcc':'on'})
self.assertEqual(response.status_code, 200)
self.assertEqual(len(mail.outbox), 4)
- bcc = set(settings.NOTIFICATION_BCC).intersect(set(settings.MANAGERS))
+ bcc = set(settings.NOTIFICATION_BCC).copy()
+ bcc.update(set(settings.MANAGERS))
for m in mail.outbox:
self.assertTrue(len(m.body) > 0)
- self.assertEqual(m.bcc, bcc)
+ self.assertEqual(set(m.bcc), bcc)
def test_email_navigation(self):
"""
load_string_into_model(model, 'rdfa', response.content)
errmsgs = list(inference.run_validation())
- self.assertEqual(len(errmsgs), 2)
- for errmsg in errmsgs:
- self.assertEqual(errmsg, 'Missing type for: http://localhost/')
+ self.assertEqual(len(errmsgs), 0)
def test_lane_with_rdf_validation(self):
from htsworkflow.util.rdfhelp import add_default_schemas, \
load_string_into_model(model, 'rdfa', response.content)
errmsgs = list(inference.run_validation())
- self.assertEqual(len(errmsgs), 2)
- for errmsg in errmsgs:
- self.assertEqual(errmsg, 'Missing type for: http://localhost/')
+ 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")