The get_permanent_link function on the flowcell model didn't work
authorDiane Trout <diane@caltech.edu>
Mon, 13 Jun 2011 21:42:53 +0000 (14:42 -0700)
committerDiane Trout <diane@caltech.edu>
Mon, 13 Jun 2011 21:42:53 +0000 (14:42 -0700)
for flowcells with parenthetical status comments.

This fixes that problem and adds a testcase to make sure the link
does show up correctly

htsworkflow/frontend/experiments/fixtures/test_flowcells.json
htsworkflow/frontend/experiments/models.py
htsworkflow/frontend/experiments/tests.py

index a37fced3f197134abeffebb5eb3c7b56b0dd837a..46c8e1d6131f2462150f624a7a254b65d39a6c34 100644 (file)
             "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"
+       }
+   }
 ]
index d28766e153ab94ecc624a670816e1a7177703015..5a977986b023c00b19ea6febdd358d01bc13f10f 100755 (executable)
@@ -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"""
index 16e31eef114d1cb562859c84bc00c0362ddde30d..a37d632a0b11d424e61291b13cc6d795d1c9a278 100644 (file)
@@ -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.