Skip to content
Snippets Groups Projects
Unverified Commit cd375d5a authored by Tiago Grego's avatar Tiago Grego Committed by GitHub
Browse files

Merge pull request #383 from james-monkeyshines/bugfix/analysis_webdata

Store web_data without newlines
parents 66994335 e4c964dc
No related branches found
No related tags found
No related merge requests found
......@@ -67,6 +67,7 @@ use strict;
use Data::Dumper;
$Data::Dumper::Terse = 1;
$Data::Dumper::Indent = 0;
@ISA = qw( Bio::EnsEMBL::DBSQL::BaseAdaptor);
......
......@@ -64,6 +64,9 @@ $analysis_ad->store($analysis);
ok(defined $analysis->dbID() );
# Check that web_data is stored without newlines
unlike(retrieve_web_data($db, $analysis->dbID), '/\n/', "No newlines in stored web_data");
# Need to explicitly delete cache, otherwise we just return that,
# and don't actually extract the data from the table and truly verify storage.
$analysis_ad->{_logic_name_cache} = {};
......@@ -89,7 +92,7 @@ $analysis->logic_name("new_dummy");
$analysis->description("new description");
$analysis->display_label("new label");
$analysis->displayable(0);
$analysis->web_data("blahblah");
$analysis->web_data({thing => 'blahblah'});
my $dbID = $analysis->dbID();
$analysis_ad->update($analysis);
my $analysis_updated = $analysis_ad->fetch_by_dbID($dbID);
......@@ -97,7 +100,10 @@ is($analysis_updated->logic_name(), "new_dummy", "Logic name is correct");
is($analysis_updated->description(), "new description", "Description is correct");
is($analysis_updated->display_label(), "new label", "Label is correct");
is($analysis_updated->displayable(), 0, "Displayable is correct");
is($analysis_updated->web_data(), "blahblah", "web_data is correct");
is($analysis_updated->web_data->{thing}, "blahblah", "web_data is correct");
# Check that web_data is stored without newlines
unlike(retrieve_web_data($db, $dbID), '/\n/', "No newlines in updated web_data");
# now try updating analysis that has no existing description
$analysis = Bio::EnsEMBL::Analysis->new();
......@@ -136,4 +142,12 @@ sub check_methods {
return $all_implemented;
}
sub retrieve_web_data {
my ($db, $dbID) = @_;
my $sql_helper = $db->dbc->sql_helper;
my $sql = "SELECT web_data FROM analysis_description WHERE analysis_id = $dbID";
return $sql_helper->execute_single_result(-SQL => $sql);
}
done_testing();
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment