From: Diane Trout Date: Mon, 13 Jun 2011 21:42:53 +0000 (-0700) Subject: The get_permanent_link function on the flowcell model didn't work X-Git-Tag: 0.5.2~25 X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=htsworkflow.git;a=commitdiff_plain;h=91ebcb04331991bd7e37b78a5410ebe77943fbce The get_permanent_link function on the flowcell model didn't work for flowcells with parenthetical status comments. This fixes that problem and adds a testcase to make sure the link does show up correctly --- diff --git a/htsworkflow/frontend/experiments/fixtures/test_flowcells.json b/htsworkflow/frontend/experiments/fixtures/test_flowcells.json index a37fced..46c8e1d 100644 --- a/htsworkflow/frontend/experiments/fixtures/test_flowcells.json +++ b/htsworkflow/frontend/experiments/fixtures/test_flowcells.json @@ -1105,6 +1105,28 @@ "experiment_type": 4, "antibody": null } - } - + }, + {"pk": 200, "model": "experiments.flowcell", + "fields": { + "paired_end": true, + "run_date": "2007-09-27 22:12:13", + "read_length": 36, + "notes": "", + "advanced_run": false, + "control_lane": 2, + "cluster_station": 3, + "sequencer": 2, + "flowcell_id": "30012AAXX (failed)" + } + }, + {"pk": 201, "model": "experiments.lane", + "fields": { + "comment": "", + "library": "11070", + "cluster_estimate": 182000, + "flowcell": 200, + "lane_number": 8, + "pM": "7" + } + } ] diff --git a/htsworkflow/frontend/experiments/models.py b/htsworkflow/frontend/experiments/models.py index d28766e..5a97798 100755 --- a/htsworkflow/frontend/experiments/models.py +++ b/htsworkflow/frontend/experiments/models.py @@ -102,8 +102,9 @@ class FlowCell(models.Model): @models.permalink def get_absolute_url(self): + flowcell_id, status = parse_flowcell_id(self.flowcell_id) return ('htsworkflow.frontend.experiments.views.flowcell_detail', - [str(self.flowcell_id)]) + [str(flowcell_id)]) def get_raw_data_directory(self): """Return location of where the raw data is stored""" diff --git a/htsworkflow/frontend/experiments/tests.py b/htsworkflow/frontend/experiments/tests.py index 16e31ee..a37d632 100644 --- a/htsworkflow/frontend/experiments/tests.py +++ b/htsworkflow/frontend/experiments/tests.py @@ -157,6 +157,20 @@ class ExperimentsTestCases(TestCase): self.failUnlessEqual(library_id, expected_ids[i]) self.failUnlessEqual(input_field['value'], library_id) + def test_library_to_flowcell_link(self): + """ + Make sure the library page includes links to the flowcell pages. + """ + self.client.login(username='supertest', password='BJOKL5kAj6aFZ6A5') + response = self.client.get('/library/11070/') + soup = BeautifulSoup(response.content) + failed_fc_span = soup.find(text='30012AAXX (failed)') + failed_fc_a = failed_fc_span.findPrevious('a') + # make sure some of our RDF made it. + self.failUnlessEqual(failed_fc_a.get('rel'), 'libns:flowcell') + self.failUnlessEqual(failed_fc_a.get('href'), '/flowcell/30012AAXX/') + + def test_lanes_for(self): """ Check the code that packs the django objects into simple types.