Deal with (failed) in flowcell names.
[htsworkflow.git] / htsworkflow / frontend / inventory / tests.py
index 01b9b2105d4094ad44caf39807bf6a0fe46d5e31..0e6754649a419f32d61dd92a1531fecdf519f600 100644 (file)
@@ -72,6 +72,31 @@ class InventoryTestCase(TestCase):
         self.failUnlessEqual('http://localhost/flowcell/%s/' % (flowcell),
                              flowcells[0])
 
+    def test_add_disk_failed_flowcell(self):
+        url = '/inventory/it/Hard Drive/'
+        #url_disk = '/inventory/8a90b6ce522311de99b00015172ce556/'
+        url_disk = '/inventory/b0792d425aa411de99b00015172ce556/'
+        indexNode = localhostNode(url)
+        diskNode = localhostNode(url_disk)
+        self.client.login(username='test', password='BJOKL5kAj6aFZ6A5')
+
+        flowcells = self.get_flowcells_from_content(url, indexNode, diskNode)
+        self.failUnlessEqual(len(flowcells), 0)
+
+        # step two link the flowcell
+        flowcell = '33THRAAXX'
+        serial = 'WCAU49042470'
+        link_url = urlresolvers.reverse(
+                'htsworkflow.frontend.inventory.views.link_flowcell_and_device',
+                args=(flowcell, serial))
+        link_response = self.client.get(link_url)
+        self.failUnlessEqual(link_response.status_code, 200)
+
+        flowcells = self.get_flowcells_from_content(url, indexNode, diskNode)
+        self.failUnlessEqual(len(flowcells), 1)
+        self.failUnlessEqual('http://localhost/flowcell/%s/' % (flowcell),
+                             flowcells[0])
+
         
     def get_flowcells_from_content(self, url, rootNode, diskNode):
         model = get_model()