From d06fc474275306e23d96360bc183b8c484e3e42a Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Sun, 25 Sep 2016 10:42:39 +0000 Subject: Test: input parameters for mapping --- test/lib/mapping.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'test/lib') diff --git a/test/lib/mapping.rb b/test/lib/mapping.rb index 08b6b5da..bd88b88e 100644 --- a/test/lib/mapping.rb +++ b/test/lib/mapping.rb @@ -1,6 +1,5 @@ # In these tests we navigate from the main page to a specific trait then hit the different mapping tool buttons (In this case pylMM and r/qtl) followed by computing the results (marker regressions). - class MappingTest end @@ -14,6 +13,8 @@ describe MappingTest do it "pyLMM mapping tool selection" do url = $host+'/show_trait?trait_id=1435395_s_at&dataset=HC_M2_0606_P' page = @agent.get(url) + json = JSON::load(File.read('test/data/input/mapping/1435395_s_at_HC_M2_0606_P.json')) + p json # get the form # form = @agent.page.form_with(:name => "my-form") # get the button you want from the form -- cgit v1.2.3 From 71890299c9f8aecb269d8dd2647b85f0a82e91ff Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Sun, 25 Sep 2016 10:51:43 +0000 Subject: Test: should be a Post with parameters filled in --- test/data/input/mapping/1435395_s_at_HC_M2_0606_P.json | 2 +- test/lib/mapping.rb | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'test/lib') diff --git a/test/data/input/mapping/1435395_s_at_HC_M2_0606_P.json b/test/data/input/mapping/1435395_s_at_HC_M2_0606_P.json index 2c4446ec..027e4d82 100644 --- a/test/data/input/mapping/1435395_s_at_HC_M2_0606_P.json +++ b/test/data/input/mapping/1435395_s_at_HC_M2_0606_P.json @@ -1,6 +1,6 @@ { "maf" : "0.01", "control_marker" : "mCV24506226", - "dataset" : "HC_M2_0606_P", + "dataset" : "HC_M2_0606_P", "do_control" : "false", "maf" : "0.01", "manhattan_plot" : "False", diff --git a/test/lib/mapping.rb b/test/lib/mapping.rb index bd88b88e..da580185 100644 --- a/test/lib/mapping.rb +++ b/test/lib/mapping.rb @@ -11,10 +11,11 @@ describe MappingTest do describe MappingTest do it "pyLMM mapping tool selection" do - url = $host+'/show_trait?trait_id=1435395_s_at&dataset=HC_M2_0606_P' - page = @agent.get(url) + url = $host+'/marker_regression?trait_id=1435395_s_at&dataset=HC_M2_0606_P' + page = @agent.post(url) json = JSON::load(File.read('test/data/input/mapping/1435395_s_at_HC_M2_0606_P.json')) p json + p page # get the form # form = @agent.page.form_with(:name => "my-form") # get the button you want from the form -- cgit v1.2.3 From ade0969bdc784d71d67d8422c6fd1238ed3ca391 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Mon, 26 Sep 2016 08:14:42 +0000 Subject: Test: mechanical Rob executes scanone test --- test/data/input/mapping/1435395_s_at_HC_M2_0606_P.json | 8 +++++--- test/lib/mapping.rb | 14 +++++++++----- wqflask/wqflask/views.py | 2 +- 3 files changed, 15 insertions(+), 9 deletions(-) (limited to 'test/lib') diff --git a/test/data/input/mapping/1435395_s_at_HC_M2_0606_P.json b/test/data/input/mapping/1435395_s_at_HC_M2_0606_P.json index 027e4d82..9744e7b2 100644 --- a/test/data/input/mapping/1435395_s_at_HC_M2_0606_P.json +++ b/test/data/input/mapping/1435395_s_at_HC_M2_0606_P.json @@ -1,6 +1,8 @@ -{ "maf" : "0.01", - "control_marker" : "mCV24506226", - "dataset" : "HC_M2_0606_P", +{ + "temp_uuid" : "unknown", +"maf" : "0.01", +"control_marker" : "mCV24506226", +"dataset" : "HC_M2_0606_P", "do_control" : "false", "maf" : "0.01", "manhattan_plot" : "False", diff --git a/test/lib/mapping.rb b/test/lib/mapping.rb index da580185..2678b127 100644 --- a/test/lib/mapping.rb +++ b/test/lib/mapping.rb @@ -5,16 +5,20 @@ end describe MappingTest do before do - @agent = Mechanize.new - @agent.agent.http.ca_file = '/etc/ssl/certs/ca-certificates.crt' end describe MappingTest do it "pyLMM mapping tool selection" do - url = $host+'/marker_regression?trait_id=1435395_s_at&dataset=HC_M2_0606_P' - page = @agent.post(url) + url = $host+'/marker_regression' # ?trait_id=1435395_s_at&dataset=HC_M2_0606_P' + @agent = Mechanize.new + @agent.agent.http.ca_file = '/etc/ssl/certs/ca-certificates.crt' + # @agent.idle_timeout = 0.01 + json = JSON::load(File.read('test/data/input/mapping/1435395_s_at_HC_M2_0606_P.json')) - p json + # p json + page = @agent.post(URI.encode(url), + json, + ({'Content-Type' => 'application/x-www-form-urlencoded'})) p page # get the form # form = @agent.page.form_with(:name => "my-form") diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index b747654a..7061e0f1 100644 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -395,6 +395,7 @@ def mapping_results_container_page(): @app.route("/marker_regression", methods=('POST',)) def marker_regression_page(): initial_start_vars = request.form + logger.debug("Marker regression called with initial_start_vars:", initial_start_vars.items()) temp_uuid = initial_start_vars['temp_uuid'] wanted = ( 'trait_id', @@ -432,7 +433,6 @@ def marker_regression_page(): 'mapmethod_rqtl_geno', 'mapmodel_rqtl_geno' ) - logger.debug("Marker regression called with initial_start_vars:", initial_start_vars) start_vars = {} for key, value in initial_start_vars.iteritems(): if key in wanted or key.startswith(('value:')): -- cgit v1.2.3 From 50a571110b6557e2b7dbc536893d3928f0a93bd2 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Mon, 26 Sep 2016 08:30:07 +0000 Subject: Mechanical Rob: make it possible to run single tests --- bin/test-website | 6 +++++- test/lib/gntest.rb | 5 +++++ test/lib/mapping.rb | 40 +++++----------------------------------- 3 files changed, 15 insertions(+), 36 deletions(-) create mode 100644 test/lib/gntest.rb (limited to 'test/lib') diff --git a/bin/test-website b/bin/test-website index 18994cc5..1d6481f4 100755 --- a/bin/test-website +++ b/bin/test-website @@ -4,7 +4,7 @@ USAGE = < 'application/x-www-form-urlencoded'})) p page - # get the form - # form = @agent.page.form_with(:name => "my-form") - # get the button you want from the form - # page.forms.each do |form| - # p form - # end - # button = page.button_with(:value => "pylmm_compute") - # submit the form using that button - # agent.submit(form, button) - # link = page.link_with(text: 'pyLMM') - # page = link.click - # puts page.uri - # link = page.link_with(text: 'Compute') - # page = link.click - # puts page.uri - # probe_link.uri.to_s.must_equal "/marker_regression" end end end - -describe MappingTest do - it "R/qtl mapping tool selection" do - break if $options[:skip_broken] - page = @agent.get($host+'/show_trait?trait_id=1435395_s_at&dataset=HC_M2_0606_P') - link = page.link_with(text: 'R/qtl') - page = link.click - puts page.uri - form.field_with(:name => 'Methods').options[2].select - link = page.link_with(text: 'Compute') - page = link.click - puts page.uri - probe_link.uri.to_s.must_equal "/marker_regression" - end -end -- cgit v1.2.3 From 2d04ad9552f5b3f0551c31797f8fa714e3af4c7a Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Mon, 26 Sep 2016 14:26:47 +0000 Subject: Test: added pylmm test --- test/data/input/mapping/1435395_s_at_HC_M2_0606_P.json | 2 +- test/lib/mapping.rb | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'test/lib') diff --git a/test/data/input/mapping/1435395_s_at_HC_M2_0606_P.json b/test/data/input/mapping/1435395_s_at_HC_M2_0606_P.json index 9744e7b2..15428553 100644 --- a/test/data/input/mapping/1435395_s_at_HC_M2_0606_P.json +++ b/test/data/input/mapping/1435395_s_at_HC_M2_0606_P.json @@ -12,7 +12,7 @@ "num_bootstrap" : "2000", "num_perm" : "", "pair_scan" : "false", - "suggestive" : "[object Object]", + "suggestive" : "0", "trait_id" : "1433387_at", "value:129S1/SvImJ" : "6.920", "value:A/J" : "7.437", diff --git a/test/lib/mapping.rb b/test/lib/mapping.rb index 47c4875b..1b52d797 100644 --- a/test/lib/mapping.rb +++ b/test/lib/mapping.rb @@ -11,6 +11,21 @@ describe MappingTest do @agent.agent.http.ca_file = '/etc/ssl/certs/ca-certificates.crt' end + describe MappingTest do + it "pylmm mapping tool selection" do + url = $host+'/marker_regression' + + json = JSON::load(File.read('test/data/input/mapping/1435395_s_at_HC_M2_0606_P.json')) + json["method"] = "pylmm" + # p json + page = @agent.post(URI.encode(url), json) + # Unpacking the page is slow - but the run is enough as a test + # form = page.forms[1] + # form = page.forms_with("marker_regression")[0] + # form.fields.select { |fld| fld.name == 'corr_dataset' }.first.value.must_equal 'HC_M2_0606_P' + end + end + describe MappingTest do it "R/qtl mapping tool selection" do url = $host+'/marker_regression' # ?trait_id=1435395_s_at&dataset=HC_M2_0606_P' -- cgit v1.2.3 From 3fa5e9c2effdab27ba9492203a875d01ddae766c Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Mon, 26 Sep 2016 14:38:27 +0000 Subject: Test: added mechanize test for CIM (reaper) --- test/lib/mapping.rb | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'test/lib') diff --git a/test/lib/mapping.rb b/test/lib/mapping.rb index 1b52d797..4c8ff632 100644 --- a/test/lib/mapping.rb +++ b/test/lib/mapping.rb @@ -20,9 +20,9 @@ describe MappingTest do # p json page = @agent.post(URI.encode(url), json) # Unpacking the page is slow - but the run is enough as a test - # form = page.forms[1] # form = page.forms_with("marker_regression")[0] - # form.fields.select { |fld| fld.name == 'corr_dataset' }.first.value.must_equal 'HC_M2_0606_P' + # form.fields.select { |fld| fld.name == 'dataset' }.first.value.must_equal 'HC_M2_0606_P' + # form.fields.select { |fld| fld.name == 'value:BXD1' }.first.value.must_equal '6.749' end end @@ -35,7 +35,22 @@ describe MappingTest do page = @agent.post(URI.encode(url), json, ({'Content-Type' => 'application/x-www-form-urlencoded'})) - p page + form = page.forms_with("marker_regression")[0] + form.fields.select { |fld| fld.name == 'dataset' }.first.value.must_equal 'HC_M2_0606_P' + form.fields.select { |fld| fld.name == 'value:BXD1' }.first.value.must_equal '6.749' + end + end + + describe MappingTest do + it "CIM mapping tool selection (using reaper)" do + url = $host+'/marker_regression' + + json = JSON::load(File.read('test/data/input/mapping/1435395_s_at_HC_M2_0606_P.json')) + json["method"] = "reaper" + page = @agent.post(URI.encode(url), json) + form = page.forms_with("marker_regression")[0] + form.fields.select { |fld| fld.name == 'dataset' }.first.value.must_equal 'HC_M2_0606_P' + form.fields.select { |fld| fld.name == 'value:BXD1' }.first.value.must_equal '6.749' end end -- cgit v1.2.3