7 import simplejson as json
9 from django.test import TestCase
11 from htsworkflow.frontend.auth import apidata
12 from htsworkflow.pipelines.retrieve_config import format_gerald_config, getCombinedOptions
14 class RetrieveTestCases(TestCase):
15 fixtures = ['test_flowcells.json']
20 def test_format_gerald(self):
21 flowcell_request = self.client.get('/experiments/config/FC12150/json', apidata)
22 self.failUnlessEqual(flowcell_request.status_code, 200)
24 print dir(flowcell_request)
25 flowcell_info = json.loads(flowcell_request.content)
27 options = getCombinedOptions(['-f','FC12150','-g',os.getcwd()])
28 genome_map = {u'Homo sapiens': '/tmp/hg18' }
30 config = format_gerald_config(options, flowcell_info, genome_map)
31 config_lines = config.split('\n')
32 lane3 = [ line for line in config_lines if re.search('Lane3', line) ]
33 self.failUnlessEqual(len(lane3), 1)
34 self.failUnlessEqual(lane3[0], '# Lane3: SL039 | Paired ends 99 GM12892')
35 human = [ line for line in config_lines if re.search('hg18', line) ]
36 self.failUnlessEqual(len(human), 1)
37 self.failUnlessEqual(human[0], '345678:ELAND_GENOME /tmp/hg18')
38 # we changed the api to force unknown genomes to be sequencing
39 sequencing = [ line for line in config_lines if re.search('sequence_pair', line) ]
40 self.failUnlessEqual(len(sequencing), 2)