From 1bb7ecc1b7faaf8a3c3abcddcb2a229c78198eaf Mon Sep 17 00:00:00 2001 From: Diane Trout Date: Tue, 26 Jun 2012 15:45:27 -0700 Subject: [PATCH] Add the ability to specify default cluster station & sequencer in the database --- htsworkflow/frontend/experiments/admin.py | 8 +- .../experiments/fixtures/initial_data.json | 7 + htsworkflow/frontend/experiments/models.py | 31 +- .../inventory/fixtures/test_harddisks.json | 381 +++++++++--------- htsworkflow/frontend/inventory/tests.py | 14 +- 5 files changed, 246 insertions(+), 195 deletions(-) diff --git a/htsworkflow/frontend/experiments/admin.py b/htsworkflow/frontend/experiments/admin.py index 5ebb266..23c8098 100644 --- a/htsworkflow/frontend/experiments/admin.py +++ b/htsworkflow/frontend/experiments/admin.py @@ -136,8 +136,8 @@ class FlowCellOptions(admin.ModelAdmin): admin.site.register(FlowCell, FlowCellOptions) class ClusterStationOptions(admin.ModelAdmin): - list_display = ('name', ) - fieldsets = ( ( None, { 'fields': ( 'name', ) } ), ) + list_display = ('name', 'isdefault',) + fieldsets = ( ( None, { 'fields': ( 'name', 'isdefault') } ), ) admin.site.register(ClusterStation, ClusterStationOptions) class SequencerSelect(Select): @@ -187,10 +187,10 @@ class SequencerSelect(Select): conditional_escape(force_unicode(option_label))) class SequencerOptions(admin.ModelAdmin): - list_display = ('name', 'active', 'instrument_name', 'model') + list_display = ('name', 'active', 'isdefault', 'instrument_name', 'model') fieldsets = ( ( None, { 'fields': ( - 'name', 'active', 'instrument_name', 'serial_number', + 'name', ('active', 'isdefault'), 'instrument_name', 'serial_number', 'model', 'comment') } ), ) admin.site.register(Sequencer, SequencerOptions) diff --git a/htsworkflow/frontend/experiments/fixtures/initial_data.json b/htsworkflow/frontend/experiments/fixtures/initial_data.json index ff619ce..dcdf191 100644 --- a/htsworkflow/frontend/experiments/fixtures/initial_data.json +++ b/htsworkflow/frontend/experiments/fixtures/initial_data.json @@ -113,6 +113,7 @@ "serial_number": "", "model": "Illumina Genome Analyzer II", "active": false, + "isdefault": false, "comment": "after 2010 pipeline name, was exchanged for hiseq" } }, @@ -124,6 +125,7 @@ "serial_number": "", "model": "Illumina Genome Analyzer IIx", "active": true, + "isdefault": false, "comment": "after 2010 pipeline name" } }, @@ -135,6 +137,7 @@ "serial_number": "", "model": "Unknown", "active": false, + "isdefault": false, "comment": "Sequenced somewhere else" } }, @@ -146,6 +149,7 @@ "serial_number": "", "model": "Illumina HiSeq 2000", "active": true, + "isdefault": true, "comment": "" } }, @@ -157,6 +161,7 @@ "serial_number": "", "model": "Illumina Genome Analyzer II", "active": false, + "isdefault": false, "comment": "earlier version of tardigrade" } }, @@ -168,6 +173,7 @@ "serial_number": "", "model": "Illumina Genome Analyzer II", "active": false, + "isdefault": false, "comment": "earlier rotifer name" } }, @@ -179,6 +185,7 @@ "serial_number": "", "model": "Illumina Genome Analyzer I", "active": false, + "isdefault": false, "comment": "our first sequencer" } } diff --git a/htsworkflow/frontend/experiments/models.py b/htsworkflow/frontend/experiments/models.py index 044dee6..ce6f532 100644 --- a/htsworkflow/frontend/experiments/models.py +++ b/htsworkflow/frontend/experiments/models.py @@ -48,10 +48,24 @@ RUN_STATUS_REVERSE_MAP = dict(((v, k) for k, v in RUN_STATUS_CHOICES)) class ClusterStation(models.Model): """List of cluster stations""" name = models.CharField(max_length=50, unique=True) + isdefault = models.BooleanField(default=False, null=False) + + class Meta: + ordering = ["-isdefault", "name"] def __unicode__(self): return unicode(self.name) + @classmethod + def default(cls): + d = cls.objects.filter(isdefault=True).all() + if len(d) > 0: + return d[0] + d = cls.objects.order_by('-id').all() + if len(d) > 0: + return d[0] + return None + class Sequencer(models.Model): """Sequencers we've owned @@ -61,10 +75,11 @@ class Sequencer(models.Model): serial_number = models.CharField(max_length=50, db_index=True) model = models.CharField(max_length=255) active = models.BooleanField(default=True, null=False) + isdefault = models.BooleanField(default=False, null=False) comment = models.CharField(max_length=255) class Meta: - ordering = ["-active", "name"] + ordering = ["-isdefault", "-active", "name"] def __unicode__(self): name = [unicode(self.name)] @@ -77,6 +92,16 @@ class Sequencer(models.Model): return ('htsworkflow.frontend.experiments.views.sequencer', [self.id]) + @classmethod + def default(cls): + d = cls.objects.filter(isdefault=True).all() + if len(d) > 0: + return d[0] + d = cls.objects.order_by('active', '-id').all() + if len(d) > 0: + return d[0] + return None + class FlowCell(models.Model): flowcell_id = models.CharField(max_length=20, unique=True, db_index=True) @@ -96,8 +121,8 @@ class FlowCell(models.Model): null=True, blank=True) - cluster_station = models.ForeignKey(ClusterStation, default=3) - sequencer = models.ForeignKey(Sequencer, default=1) + cluster_station = models.ForeignKey(ClusterStation, default=ClusterStation.default) + sequencer = models.ForeignKey(Sequencer, default=Sequencer.default) notes = models.TextField(blank=True) diff --git a/htsworkflow/frontend/inventory/fixtures/test_harddisks.json b/htsworkflow/frontend/inventory/fixtures/test_harddisks.json index 7ca5b0c..9d4d333 100644 --- a/htsworkflow/frontend/inventory/fixtures/test_harddisks.json +++ b/htsworkflow/frontend/inventory/fixtures/test_harddisks.json @@ -1,271 +1,290 @@ [ + { "model": "experiments.Sequencer", + "pk": 7, + "fields": { + "name": "First sequencer", + "instrument_name": "USI-EAS99", + "serial_number": "", + "model": "Illumina Genome Analyzer I", + "active": false, + "isdefault": false, + "comment": "my first sequencer" + } + }, + { "model": "experiments.ClusterStation", + "pk": 1, + "fields": { + "name": "Station", + "isdefault": true + } + }, { - "pk": 1, - "model": "inventory.vendor", + "pk": 1, + "model": "inventory.vendor", "fields": { - "url": "http://www.newegg.com/", + "url": "http://www.newegg.com/", "name": "newegg.com" } - }, + }, { - "pk": 1, - "model": "inventory.location", + "pk": 1, + "model": "inventory.location", "fields": { - "uuid": "e344a4a2522211de99b00015172ce556", - "notes": "", - "location_description": "Office 1", + "uuid": "e344a4a2522211de99b00015172ce556", + "notes": "", + "location_description": "Office 1", "name": "Dev Office" } - }, + }, { - "pk": 1, - "model": "inventory.iteminfo", + "pk": 1, + "model": "inventory.iteminfo", "fields": { - "model_id": "WD10EADS-00L5B1", - "vendor": 1, - "lot_number": "", - "url": "http://www.newegg.com/Product/Product.aspx?Item=N82E16822136317&Tpk=WD10EADS", - "warranty_months": 24, - "notes": "", - "part_number": "", - "purchase_date": "2009-05-19", + "model_id": "WD10EADS-00L5B1", + "vendor": 1, + "lot_number": "", + "url": "http://www.newegg.com/Product/Product.aspx?Item=N82E16822136317&Tpk=WD10EADS", + "warranty_months": 24, + "notes": "", + "part_number": "", + "purchase_date": "2009-05-19", "qty_purchased": 17 } - }, + }, { - "pk": 1, - "model": "inventory.itemtype", + "pk": 1, + "model": "inventory.itemtype", "fields": { - "name": "Hard Drive", + "name": "Hard Drive", "description": null } - }, + }, { - "pk": 1, - "model": "inventory.itemstatus", + "pk": 1, + "model": "inventory.itemstatus", "fields": { - "notes": "", + "notes": "", "name": "Used" } - }, + }, { - "pk": 2, - "model": "inventory.itemstatus", + "pk": 2, + "model": "inventory.itemstatus", "fields": { - "notes": "", + "notes": "", "name": "Unused" } - }, + }, { - "pk": 1, - "model": "inventory.item", + "pk": 1, + "model": "inventory.item", "fields": { - "status": null, - "modified_date": "2009-08-10 16:58:44", - "uuid": "8a90b6ce522311de99b00015172ce556", - "barcode_id": "WCAU49183397", - "notes": "", - "item_info": 1, - "force_use_uuid": false, - "item_type": 1, - "location": 1, + "status": null, + "modified_date": "2009-08-10 16:58:44", + "uuid": "8a90b6ce522311de99b00015172ce556", + "barcode_id": "WCAU49183397", + "notes": "", + "item_info": 1, + "force_use_uuid": false, + "item_type": 1, + "location": 1, "creation_date": "2009-06-05 15:52:26" } - }, + }, { - "pk": 2, - "model": "inventory.item", + "pk": 2, + "model": "inventory.item", "fields": { - "status": null, - "modified_date": "2009-06-16 11:38:24", - "uuid": "b0792d425aa411de99b00015172ce556", - "barcode_id": "WCAU49042470", - "notes": "", - "item_info": 1, - "force_use_uuid": false, - "item_type": 1, - "location": 1, + "status": null, + "modified_date": "2009-06-16 11:38:24", + "uuid": "b0792d425aa411de99b00015172ce556", + "barcode_id": "WCAU49042470", + "notes": "", + "item_info": 1, + "force_use_uuid": false, + "item_type": 1, + "location": 1, "creation_date": "2009-06-16 11:37:04" } - }, + }, { - "pk": 1, - "model": "inventory.printertemplate", + "pk": 1, + "model": "inventory.printertemplate", "fields": { - "default": false, - "item_type": 1, - "printer": 2, + "default": false, + "item_type": 1, + "printer": 2, "template": "^FX=========================\r\n^FX 3\"x3\" Label\r\n^FX=========================\r\n^XA\r\n\r\n\r\n^FX======== Left Side ===========\r\n\r\n^FX------------\r\n^FX ^LH changes the 0,0 point of all subsequent location references\r\n^FX------------\r\n\r\n^LH0,50\r\n\r\n^FX ---Header---\r\n\r\n^FO25,0\r\n^CF0,50\r\n^FB250,2,,C\r\n^FD{{ item.barcode_id }}^FS\r\n\r\n^FX ---Column 1: Flowcells---\r\n\r\n^FX-----------------\r\n^FX FB command for automatic text formatting:\r\n^FX ^FB[dot width of area], [max # of lines], [change line spacing], [justification: L, C, R, J], [hanging indent]\r\n^FX-----------------\r\n\r\n^CF0,30,30\r\n^FO75,125\r\n^FB275,19,,L\r\n^FD{% for flowcell in flowcell_id_list %}{{ flowcell }}{% if not forloop.last %}\\&{% endif %}{% endfor %}^FS\r\n^FX ---Date---\r\n\r\n^FO0,725\r\n^CF0,35\r\n^FB300,2,,C\r\n^FD{{ oldest_rundate|date:\"YMd\" }} - {{ latest_rundate|date:\"YMd\" }}^FS\r\n\r\n^FX ---Barcode---\r\n\r\n^FO135,795\r\n^BXN,3,200^FDinvb|{{ item.barcode_id }}^FS\r\n\r\n^FX======== Right Side ===========\r\n\r\n^LH300,60\r\n\r\n^FX ---Header---\r\n\r\n^FO0,0\r\n^CF0,50\r\n^FB600,2,,C\r\n^FD{{ barcode_id }}^FS\r\n\r\n^FX ---Dividing line---\r\n\r\n^FX---------------\r\n^FX GB command:\r\n^FX ^GB[box width], [box height], [border thickness], [color: B, W], [corner rounding: 0-8]^FS\r\n^FX---------------\r\n\r\n^FO0,100\r\n^GB0,600,10^FS\r\n\r\n^FX ---Column 2: Libraries 1-20---\r\n\r\n^CF0,30,30\r\n^FO75,100\r\n^FB100,20,,L\r\n^FD{% for lib_id in library_id_list_1_to_20 %}{{ lib_id }}{% if not forloop.last %}\\&{% endif %}{% endfor %}^FS\r\n\r\n^FX ---Column 3: Libraries 21-40---\r\n\r\n^CF0,30,30\r\n^FO200,100\r\n^FB100,20,,L\r\n^FD{% for lib_id in library_id_list_21_to_40 %}{{ lib_id }}{% if not forloop.last %}\\&{% endif %}{% endfor %}^FS\r\n\r\n^FX ---Column 4: Libraries 41-60---\r\n\r\n^CF0,30,30\r\n^FO325,100\r\n^FB100,20,,L\r\n^FD{% for lib_id in library_id_list_41_to_60 %}{{ lib_id }}{% if not forloop.last %}\\&{% endif %}{% endfor %}^FS\r\n\r\n^FX ---Column 5: Libraries 61-80---\r\n\r\n^CF0,30,30\r\n^FO450,100\r\n^FB100,20,,L\r\n^FD{% for lib_id in library_id_list_61_to_80 %}{{ lib_id }}{% if not forloop.last %}\\&{% endif %}{% endfor %}^FS\r\n\r\n^FX ---Date---\r\n\r\n^FO0,715\r\n^CF0,35\r\n^FB600,2,,C\r\n^FDRun Dates: {{ oldest_rundate|date:\"YMd\" }}-{{ latest_rundate|date:\"YMd\" }}^FS\r\n\r\n^FX ---Barcode---\r\n\r\n^FO255,785\r\n^BXN,3,200^FDinvb|{{ item.barcode_id }}^FS\r\n\r\n^LH0,0\r\n^FX ---End---\r\n^XZ\r\n" } - }, + }, { - "pk": 2, - "model": "inventory.printertemplate", + "pk": 2, + "model": "inventory.printertemplate", "fields": { - "default": true, - "item_type": 2, - "printer": 1, + "default": true, + "item_type": 2, + "printer": 1, "template": "^FX=========================\r\n^FX Harddrive Location Tracking Label\r\n^FX 300x375 dots\r\n^FX=========================\r\n\r\n^XA\r\n^LH 0,25\r\n\r\n^FO0,0\r\n^CF0,35\r\n^FB375,1,,C\r\n^FD{{ item.item_type.name }}:^FS\r\n\r\n^FX -------Text contains HD serial #-------------\r\n^FO15,75\r\n^CF0,42\r\n^FB325,3,,C\r\n^FD{% if use_uuid %}{{ item.uuid }}{% else %}{{ item.barcode_id }}{% endif %}^FS\r\n\r\n^FX -------Barcode contains HD serial #-----------\r\n^FO150,200\r\n^BXN,3,200\r\n^FD{% if use_uuid %}invu|{{ item.uuid }}{% else %}invb|{{ item.barcode_id }}{% endif %}^FS\r\n\r\n^XZ\r\n" } - }, + }, { - "pk": 3, - "model": "inventory.printertemplate", + "pk": 3, + "model": "inventory.printertemplate", "fields": { - "default": false, - "item_type": 6, - "printer": 1, + "default": false, + "item_type": 6, + "printer": 1, "template": "^XA\r\n\r\n^FX ---SIDE LABEL---\r\n^LH 190,40\r\n^CF 0,30\r\n\r\n^FX------Sideways ID------\r\n^FO 0,25\r\n^TB R,100,40\r\n^FD{{ library.id }}^FS\r\n^FX------Sideways Line------\r\n^FO 50,0\r\n^GB 5,200,5^FS\r\n\r\n^FX-------Name----------\r\n^FO 65,20\r\n^FB 325,4\r\n^FD{{ library.library_name }}^FS\r\n\r\n^FX ---TOP LABEL---\r\n^LH 12,28\r\n^CF 0,30\r\n\r\n^FX----ID #----\r\n^FO 5,25\r\n^FB 145,1,,C\r\n^FD{{ library.id }}^FS\r\n\r\n^FX----Name----\r\n^CF 0,16\r\n^FO 13,47\r\n^TB N,130,30\r\n^FD{{ library.library_name }}^FS\r\n\r\n^FX--------Barcode--------\r\n^FO 50,80\r\n^BXN ,3,200\r\n^FDl|0000000{{ library.id }}|woldlab^FS\r\n\r\n{% if not library.hidden %}\r\n^FX-----Border-------\r\n^FO 0,0\r\n^GC 150,10\r\n^FX ---End---\r\n{% endif %}\r\n^XZ\r\n" } - }, + }, { - "pk": 1, - "model": "inventory.longtermstorage", + "pk": 1, + "model": "inventory.longtermstorage", "fields": { "libraries": [ - "10001", - "10002", + "10001", + "10002", "10003" - ], - "modified_date": "2009-06-01 00:00:00", + ], + "modified_date": "2009-06-01 00:00:00", "storage_devices": [ 1 - ], + ], "flowcell": 1, "creation_date": "2009-06-01 00:00:00" } }, { - "pk": 2, - "model": "inventory.longtermstorage", + "pk": 2, + "model": "inventory.longtermstorage", "fields": { "libraries": [ - "10001", - "10002", + "10001", + "10002", "10003" - ], - "modified_date": "2009-06-01 00:00:00", + ], + "modified_date": "2009-06-01 00:00:00", "storage_devices": [ 1 - ], + ], "flowcell": 2, "creation_date": "2009-06-01 00:00:00" } }, - {"pk": 1, "model": "experiments.flowcell", + {"pk": 1, "model": "experiments.flowcell", "fields": { - "paired_end": true, - "run_date": "2009-09-11 22:12:13", - "read_length": 75, + "paired_end": true, + "run_date": "2009-09-11 22:12:13", + "read_length": 75, "notes": "", "advanced_run": false, "control_lane": 2, "flowcell_id": "11ONEAAXX" } - }, - {"pk": 2, "model": "experiments.flowcell", + }, + {"pk": 2, "model": "experiments.flowcell", "fields": { - "paired_end": false, - "run_date": "2010-09-11 22:12:13", - "read_length": 75, + "paired_end": false, + "run_date": "2010-09-11 22:12:13", + "read_length": 75, "notes": "", "advanced_run": false, "control_lane": 2, "flowcell_id": "22TWOAAXX" } - }, - {"pk": 3, "model": "experiments.flowcell", + }, + {"pk": 3, "model": "experiments.flowcell", "fields": { - "paired_end": false, - "run_date": "2010-09-11 22:12:13", - "read_length": 75, + "paired_end": false, + "run_date": "2010-09-11 22:12:13", + "read_length": 75, "notes": "", "advanced_run": false, "control_lane": 2, "flowcell_id": "33THRAAXX (failed)" } - }, - {"pk": "10001", "model": "samples.library", + }, + {"pk": "10001", "model": "samples.library", "fields": { - "ten_nM_dilution": false, - "gel_cut_size": 400, - "library_name": "10001", - "creation_date": "2009-07-21", - "cell_line": 1, - "library_species": 2, - "library_type": null, - "made_by": "Igor", + "ten_nM_dilution": false, + "gel_cut_size": 400, + "library_name": "10001", + "creation_date": "2009-07-21", + "cell_line": 1, + "library_species": 2, + "library_type": null, + "made_by": "Igor", "affiliations": [ 1 - ], - "replicate": 1, - "condition": 1, - "hidden": false, - "stopping_point": "Done", - "tags": [], - "made_for": "Test", - "amplified_from_sample": null, - "notes": "", - "undiluted_concentration": "1", - "successful_pM": null, - "experiment_type": 10, + ], + "replicate": 1, + "condition": 1, + "hidden": false, + "stopping_point": "Done", + "tags": [], + "made_for": "Test", + "amplified_from_sample": null, + "notes": "", + "undiluted_concentration": "1", + "successful_pM": null, + "experiment_type": 10, "antibody": null } - }, - {"pk": "10002", "model": "samples.library", + }, + {"pk": "10002", "model": "samples.library", "fields": { - "ten_nM_dilution": false, - "gel_cut_size": 400, - "library_name": "10002", - "creation_date": "2009-07-21", - "cell_line": 1, - "library_species": 2, - "library_type": null, - "made_by": "Igor", + "ten_nM_dilution": false, + "gel_cut_size": 400, + "library_name": "10002", + "creation_date": "2009-07-21", + "cell_line": 1, + "library_species": 2, + "library_type": null, + "made_by": "Igor", "affiliations": [ 1 - ], - "replicate": 1, - "condition": 1, - "hidden": false, - "stopping_point": "Done", - "tags": [], - "made_for": "Test", - "amplified_from_sample": null, - "notes": "", - "undiluted_concentration": "1", - "successful_pM": null, - "experiment_type": 10, + ], + "replicate": 1, + "condition": 1, + "hidden": false, + "stopping_point": "Done", + "tags": [], + "made_for": "Test", + "amplified_from_sample": null, + "notes": "", + "undiluted_concentration": "1", + "successful_pM": null, + "experiment_type": 10, "antibody": null } - }, - {"pk": "10003", "model": "samples.library", + }, + {"pk": "10003", "model": "samples.library", "fields": { - "ten_nM_dilution": false, - "gel_cut_size": 400, - "library_name": "10003", - "creation_date": "2009-07-21", - "cell_line": 1, - "library_species": 2, - "library_type": null, - "made_by": "Igor", + "ten_nM_dilution": false, + "gel_cut_size": 400, + "library_name": "10003", + "creation_date": "2009-07-21", + "cell_line": 1, + "library_species": 2, + "library_type": null, + "made_by": "Igor", "affiliations": [ 1 - ], - "replicate": 1, - "condition": 1, - "hidden": false, - "stopping_point": "Done", - "tags": [], - "made_for": "Test", - "amplified_from_sample": null, - "notes": "", - "undiluted_concentration": "1", - "successful_pM": null, - "experiment_type": 10, + ], + "replicate": 1, + "condition": 1, + "hidden": false, + "stopping_point": "Done", + "tags": [], + "made_for": "Test", + "amplified_from_sample": null, + "notes": "", + "undiluted_concentration": "1", + "successful_pM": null, + "experiment_type": 10, "antibody": null } - }, + }, {"pk": 1, "model": "experiments.lane", "fields": { "comment": "10001 lane 1", @@ -275,7 +294,7 @@ "lane_number": 1, "pM": "8" } - }, + }, {"pk": 2, "model": "experiments.lane", "fields": { "comment": "10002 lane 2", @@ -285,7 +304,7 @@ "lane_number": 2, "pM": "8" } - }, + }, {"pk": 3, "model": "experiments.lane", "fields": { "comment": "10003 lane 3", @@ -295,7 +314,7 @@ "lane_number": 3, "pM": "8" } - }, + }, {"pk": 4, "model": "experiments.lane", "fields": { "comment": "10004 lane 4", @@ -305,7 +324,7 @@ "lane_number": 4, "pM": "8" } - }, + }, {"pk": 5, "model": "experiments.lane", "fields": { "comment": "10001 lane 1", @@ -315,7 +334,7 @@ "lane_number": 1, "pM": "8" } - }, + }, {"pk": 6, "model": "experiments.lane", "fields": { "comment": "10001 lane 1", @@ -325,7 +344,7 @@ "lane_number": 2, "pM": "8" } - }, + }, {"pk": 7, "model": "experiments.lane", "fields": { "comment": "10003 lane 8", @@ -335,7 +354,7 @@ "lane_number": 8, "pM": "8" } - }, + }, {"pk": 8, "model": "experiments.lane", "fields": { "comment": "10002 lane 8", @@ -355,7 +374,7 @@ "lane_number": 4, "pM": "8" } - }, + }, {"pk": 10, "model": "experiments.lane", "fields": { "comment": "10001 lane 1", @@ -365,7 +384,7 @@ "lane_number": 1, "pM": "8" } - }, + }, {"pk": 11, "model": "experiments.lane", "fields": { "comment": "10001 lane 1", @@ -375,7 +394,7 @@ "lane_number": 2, "pM": "8" } - }, + }, {"pk": 12, "model": "experiments.lane", "fields": { "comment": "10003 lane 8", @@ -385,7 +404,7 @@ "lane_number": 8, "pM": "8" } - }, + }, {"pk": 13, "model": "experiments.lane", "fields": { "comment": "10002 lane 8", diff --git a/htsworkflow/frontend/inventory/tests.py b/htsworkflow/frontend/inventory/tests.py index 0e67546..024a334 100644 --- a/htsworkflow/frontend/inventory/tests.py +++ b/htsworkflow/frontend/inventory/tests.py @@ -22,7 +22,7 @@ class InventoryTestCase(TestCase): user = User.objects.get(pk=5) self.failUnlessEqual(user.username, 'test') - + def test_item(self): url = '/inventory/8a90b6ce522311de99b00015172ce556/' self.client.login(username='test', password='BJOKL5kAj6aFZ6A5') @@ -41,7 +41,7 @@ class InventoryTestCase(TestCase): indexNode = localhostNode(url) diskNode = localhostNode('/inventory/8a90b6ce522311de99b00015172ce556/') self.client.login(username='test', password='BJOKL5kAj6aFZ6A5') - + flowcells = self.get_flowcells_from_content(url, indexNode, diskNode) self.failUnlessEqual(len(flowcells), 2) self.failUnless('http://localhost/flowcell/11ONEAAXX/' in flowcells) @@ -97,21 +97,21 @@ class InventoryTestCase(TestCase): self.failUnlessEqual('http://localhost/flowcell/%s/' % (flowcell), flowcells[0]) - + def get_flowcells_from_content(self, url, rootNode, diskNode): model = get_model() - + response = self.client.get(url) self.failUnlessEqual(response.status_code, 200) - + load_string_into_model(model, 'rdfa', response.content, rootNode.uri) targets = model.get_targets(diskNode, libraryOntology['flowcell_id']) flowcells = [ str(x.uri) for x in targets] return flowcells - + def suite(): return unittest.makeSuite(InventoryTestCase, 'test') if __name__ == "__main__": unittest.main(defaultTest="suite") - + -- 2.30.2