From ab74b21a3c45abc940a2154e584a01089c910cbe Mon Sep 17 00:00:00 2001 From: Diane Trout Date: Wed, 12 Feb 2014 17:27:30 -0800 Subject: [PATCH] Postgresql has referential integrety checking. So some of my dangling foreign keys caused tests to failed. I resolved them through a few different ways, * adding initial_data to include description tables * adding some additional data to the test fixture. * renumbering affiliation keys to match my small test list. I had to reorder the app list because I think there was a dependency in the wrong order. --- .../experiments/fixtures/test_flowcells.json | 4 +-- .../inventory/fixtures/test_harddisks.json | 18 ++++++++++ .../frontend/inventory/test_inventory.py | 2 +- .../samples/fixtures/test_samples.json | 36 +++++++++++++++---- htsworkflow/settings.py | 2 +- 5 files changed, 52 insertions(+), 10 deletions(-) diff --git a/htsworkflow/frontend/experiments/fixtures/test_flowcells.json b/htsworkflow/frontend/experiments/fixtures/test_flowcells.json index a89d2c4..15d00c6 100644 --- a/htsworkflow/frontend/experiments/fixtures/test_flowcells.json +++ b/htsworkflow/frontend/experiments/fixtures/test_flowcells.json @@ -203,7 +203,7 @@ "library_type": 2, "made_by": "Lorian", "affiliations": [ - 41 + 3 ], "replicate": 1, "condition": 1, @@ -636,7 +636,7 @@ "library_type": 1, "made_by": "Lorian", "affiliations": [ - 6 + 4 ], "replicate": 1, "condition": null, diff --git a/htsworkflow/frontend/inventory/fixtures/test_harddisks.json b/htsworkflow/frontend/inventory/fixtures/test_harddisks.json index f757fa8..c990260 100644 --- a/htsworkflow/frontend/inventory/fixtures/test_harddisks.json +++ b/htsworkflow/frontend/inventory/fixtures/test_harddisks.json @@ -1,4 +1,22 @@ [ + {"pk": 1, + "model": "bcmagic.printer", + "fields": {"name": "ZM400 1.25x1", + "label_height": 1.0, + "notes": "Everyday use labels", + "label_width": 1.25, + "label_shape": "Square", + "model": "Zebra ZM400", + "ip_address": "131.215.34.116"}}, + {"pk": 2, + "model": "bcmagic.printer", + "fields": {"name": "ZM400 3x3", + "label_height": 3.0, + "notes": "Larger everyday use labels", + "label_width": 3.0, + "label_shape": "Square", + "model": "Zebra ZM400", + "ip_address": "131.215.34.117"}}, { "model": "experiments.Sequencer", "pk": 7, "fields": { diff --git a/htsworkflow/frontend/inventory/test_inventory.py b/htsworkflow/frontend/inventory/test_inventory.py index d7c2336..2456ff3 100644 --- a/htsworkflow/frontend/inventory/test_inventory.py +++ b/htsworkflow/frontend/inventory/test_inventory.py @@ -16,7 +16,7 @@ def localhostNode(url): return RDF.Node(RDF.Uri('http://localhost%s' % (url,))) class InventoryTestCase(TestCase): - fixtures = ['test_user', 'test_harddisks'] + fixtures = ['initial_data', 'test_user', 'test_harddisks'] def test_fixture(self): # make sure that some of our test data is was loaded diff --git a/htsworkflow/frontend/samples/fixtures/test_samples.json b/htsworkflow/frontend/samples/fixtures/test_samples.json index f368b71..41824e0 100644 --- a/htsworkflow/frontend/samples/fixtures/test_samples.json +++ b/htsworkflow/frontend/samples/fixtures/test_samples.json @@ -29,6 +29,30 @@ "email": "bob@some.where.else" } }, + {"pk": 3, "model": "samples.affiliation", + "fields": { + "users": [], + "contact": "group 3", + "name": "affiliation 3", + "email": "pk3@example.com" + } + }, + {"pk": 4, "model": "samples.affiliation", + "fields": { + "users": [], + "contact": "group 4", + "name": "affiliation 4", + "email": "pk1@example.com" + } + }, + {"pk": 5, "model": "samples.affiliation", + "fields": { + "users": [], + "contact": "group 5", + "name": "affiliation 5", + "email": "pk5@example.com" + } + }, {"pk": 153, "model": "experiments.flowcell", "fields": { "paired_end": true, @@ -103,7 +127,7 @@ "library_type": 2, "made_by": "Lorian", "affiliations": [ - 41 + 3 ], "replicate": 1, "condition": 1, @@ -132,9 +156,9 @@ "library_type": 2, "made_by": "Brian Williams", "affiliations": [ - 4, - 8, - 12 + 1, + 2, + 4 ], "replicate": 1, "condition": 1, @@ -163,7 +187,7 @@ "library_type": 2, "made_by": "Lorian", "affiliations": [ - 41 + 4 ], "replicate": 1, "condition": 1, @@ -192,7 +216,7 @@ "library_type": 2, "made_by": "Lorian", "affiliations": [ - 41 + 4 ], "replicate": 1, "condition": 1, diff --git a/htsworkflow/settings.py b/htsworkflow/settings.py index 1952d1c..dce3d90 100644 --- a/htsworkflow/settings.py +++ b/htsworkflow/settings.py @@ -46,8 +46,8 @@ INSTALLED_APPS = ( 'htsworkflow.frontend.eland_config', 'htsworkflow.frontend.samples', 'htsworkflow.frontend.experiments', - 'htsworkflow.frontend.inventory', 'htsworkflow.frontend.bcmagic', + 'htsworkflow.frontend.inventory', 'htsworkflow.frontend.labels', ) -- 2.30.2