galaxy-commits
Threads by month
- ----- 2026 -----
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- 15302 discussions
commit/galaxy-central: carlfeberhard: HDA API: allow index filtering by deleted and/or visible
by commits-noreply@bitbucket.org 26 Nov '13
by commits-noreply@bitbucket.org 26 Nov '13
26 Nov '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/9f31145b33ce/
Changeset: 9f31145b33ce
User: carlfeberhard
Date: 2013-11-26 18:28:17
Summary: HDA API: allow index filtering by deleted and/or visible
Affected #: 1 file
diff -r f8f21ec94e5f9baa5718cbff313b085588ad7c5a -r 9f31145b33ceb83e539bcdd571b48ff440b4c1eb lib/galaxy/webapps/galaxy/api/history_contents.py
--- a/lib/galaxy/webapps/galaxy/api/history_contents.py
+++ b/lib/galaxy/webapps/galaxy/api/history_contents.py
@@ -50,6 +50,7 @@
# otherwise, check permissions for the history first
else:
history = self.get_history( trans, history_id, check_ownership=True, check_accessible=True )
+
# if ids, return _FULL_ data (as show) for each id passed
if ids:
ids = ids.split( ',' )
@@ -58,19 +59,39 @@
if encoded_hda_id in ids:
#TODO: share code with show
rval.append( self._detailed_hda_dict( trans, hda ) )
+
# if no ids passed, return a _SUMMARY_ of _all_ datasets in the history
else:
+ # details param allows a mixed set of summary and detailed hdas
+ #TODO: this is getting convoluted due to backwards compat
details = kwd.get( 'details', None ) or []
if details and details != 'all':
details = util.listify( details )
+ # by default return all datasets - even if deleted or hidden (defaulting the next switches to None)
+ # if specified return those datasets that match the setting
+ # backwards compat
+ return_deleted = util.string_as_bool_or_none( kwd.get( 'deleted', None ) )
+ return_visible = util.string_as_bool_or_none( kwd.get( 'visible', None ) )
+
for hda in history.datasets:
+ # if either return_ setting has been requested (!= None), skip hdas that don't match the request
+ if return_deleted is not None:
+ if( ( return_deleted and not hda.deleted )
+ or ( not return_deleted and hda.deleted ) ):
+ continue
+ if return_visible is not None:
+ if( ( return_visible and not hda.visible )
+ or ( not return_visible and hda.visible ) ):
+ continue
+
encoded_hda_id = trans.security.encode_id( hda.id )
if( ( encoded_hda_id in details )
or ( details == 'all' ) ):
rval.append( self._detailed_hda_dict( trans, hda ) )
else:
rval.append( self._summary_hda_dict( trans, history_id, hda ) )
+
except Exception, e:
# for errors that are not specific to one hda (history lookup or summary list)
rval = "Error in history API at listing contents: " + str( e )
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: carlfeberhard: UI: remove existing popupmenu if another is clicked
by commits-noreply@bitbucket.org 26 Nov '13
by commits-noreply@bitbucket.org 26 Nov '13
26 Nov '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/f8f21ec94e5f/
Changeset: f8f21ec94e5f
User: carlfeberhard
Date: 2013-11-26 18:12:00
Summary: UI: remove existing popupmenu if another is clicked
Affected #: 2 files
diff -r 6fc4a11418458903a35aac3fd4878ab6c4265483 -r f8f21ec94e5f9baa5718cbff313b085588ad7c5a static/scripts/mvc/ui.js
--- a/static/scripts/mvc/ui.js
+++ b/static/scripts/mvc/ui.js
@@ -190,6 +190,7 @@
* view for a popup menu
*/
var PopupMenu = Backbone.View.extend({
+//TODO: maybe better as singleton off the Galaxy obj
/** Cache the desired button element and options, set up the button click handler
* NOTE: attaches this view as HTML/jQ data on the button for later use.
*/
@@ -201,6 +202,8 @@
// set up button click -> open menu behavior
var menu = this;
this.$button.click( function( event ){
+ // if there's already a menu open, remove it
+ $( '.popmenu-wrapper' ).remove();
menu._renderAndShow( event );
return false;
});
@@ -209,10 +212,8 @@
// render the menu, append to the page body at the click position, and set up the 'click-away' handlers, show
_renderAndShow: function( clickEvent ){
this.render();
- this.$el.appendTo( 'body' );
- this.$el.css( this._getShownPosition( clickEvent ));
+ this.$el.appendTo( 'body' ).css( this._getShownPosition( clickEvent )).show();
this._setUpCloseBehavior();
- this.$el.show();
},
// render the menu
@@ -289,20 +290,26 @@
// bind an event handler to all available frames so that when anything is clicked
// the menu is removed from the DOM and the event handler unbinds itself
_setUpCloseBehavior: function(){
+ var menu = this;
+//TODO: alternately: focus hack, blocking overlay, jquery.blockui
+
// function to close popup and unbind itself
- var menu = this;
- var closePopupWhenClicked = function( $elClicked ){
- $elClicked.one( "click.close_popup", function(){
- menu.remove();
- });
- };
+ function closePopup( event ){
+ $( document ).off( 'click.close_popup' );
+ if( window.parent !== window ){
+ $( window.parent.document ).off( "click.close_popup" );
+ } else {
+ $( 'iframe#galaxy_main' ).contents().off( "click.close_popup" );
+ }
+ menu.remove();
+ }
- // bind to current, parent, and sibling frames
- closePopupWhenClicked( $( window.document ));
- closePopupWhenClicked( $( window.top.document ));
- _.each( window.top.frames, function( siblingFrame ){
- closePopupWhenClicked( $( siblingFrame.document ));
- });
+ $( 'html' ).one( "click.close_popup", closePopup );
+ if( window.parent !== window ){
+ $( window.parent.document ).find( 'html' ).one( "click.close_popup", closePopup );
+ } else {
+ $( 'iframe#galaxy_main' ).contents().one( "click.close_popup", closePopup );
+ }
},
// add a menu option/item at the given index
diff -r 6fc4a11418458903a35aac3fd4878ab6c4265483 -r f8f21ec94e5f9baa5718cbff313b085588ad7c5a static/scripts/packed/mvc/ui.js
--- a/static/scripts/packed/mvc/ui.js
+++ b/static/scripts/packed/mvc/ui.js
@@ -1,1 +1,1 @@
-var IconButton=Backbone.Model.extend({defaults:{title:"",icon_class:"",on_click:null,menu_options:null,is_menu_button:true,id:null,href:null,target:null,enabled:true,visible:true,tooltip_config:{}}});var IconButtonView=Backbone.View.extend({initialize:function(){this.model.attributes.tooltip_config={placement:"bottom"};this.model.bind("change",this.render,this)},render:function(){this.$el.tooltip("hide");var a=this.template(this.model.toJSON());a.tooltip(this.model.get("tooltip_config"));this.$el.replaceWith(a);this.setElement(a);return this},events:{click:"click"},click:function(a){if(_.isFunction(this.model.get("on_click"))){this.model.get("on_click")(a);return false}return true},template:function(b){var a='title="'+b.title+'" class="icon-button';if(b.is_menu_button){a+=" menu-button"}a+=" "+b.icon_class;if(!b.enabled){a+="_disabled"}a+='"';if(b.id){a+=' id="'+b.id+'"'}a+=' href="'+b.href+'"';if(b.target){a+=' target="'+b.target+'"'}if(!b.visible){a+=' style="display: none;"'}if(b.enabled){a="<a "+a+"/>"}else{a="<span "+a+"/>"}return $(a)}});var IconButtonCollection=Backbone.Collection.extend({model:IconButton});var IconButtonMenuView=Backbone.View.extend({tagName:"div",initialize:function(){this.render()},render:function(){var a=this;this.collection.each(function(d){var b=$("<a/>").attr("href","javascript:void(0)").attr("title",d.attributes.title).addClass("icon-button menu-button").addClass(d.attributes.icon_class).appendTo(a.$el).click(d.attributes.on_click);if(d.attributes.tooltip_config){b.tooltip(d.attributes.tooltip_config)}var c=d.get("options");if(c){make_popupmenu(b,c)}});return this}});var create_icon_buttons_menu=function(b,a){if(!a){a={}}var c=new IconButtonCollection(_.map(b,function(d){return new IconButton(_.extend(d,a))}));return new IconButtonMenuView({collection:c})};var Grid=Backbone.Collection.extend({});var GridView=Backbone.View.extend({});var PopupMenu=Backbone.View.extend({initialize:function(b,a){this.$button=b||$("<div/>");this.options=a||[];var c=this;this.$button.click(function(d){c._renderAndShow(d);return false})},_renderAndShow:function(a){this.render();this.$el.appendTo("body");this.$el.css(this._getShownPosition(a));this._setUpCloseBehavior();this.$el.show()},render:function(){this.$el.addClass("popmenu-wrapper").hide().css({position:"absolute"}).html(this.template(this.$button.attr("id"),this.options));if(this.options.length){var a=this;this.$el.find("li").each(function(c,b){var d=a.options[c];if(d.func){$(this).children("a.popupmenu-option").click(function(e){d.func.call(a,e,d)})}})}return this},template:function(b,a){return['<ul id="',b,'-menu" class="dropdown-menu">',this._templateOptions(a),"</ul>"].join("")},_templateOptions:function(a){if(!a.length){return"<li>(no options)</li>"}return _.map(a,function(d){if(d.divider){return'<li class="divider"></li>'}else{if(d.header){return['<li class="head"><a href="javascript:void(0);">',d.html,"</a></li>"].join("")}}var c=d.href||"javascript:void(0);",e=(d.target)?(' target="'+d.target+'"'):(""),b=(d.checked)?('<span class="fa fa-check"></span>'):("");return['<li><a class="popupmenu-option" href="',c,'"',e,">",b,d.html,"</a></li>"].join("")}).join("")},_getShownPosition:function(b){var c=this.$el.width();var a=b.pageX-c/2;a=Math.min(a,$(document).scrollLeft()+$(window).width()-c-5);a=Math.max(a,$(document).scrollLeft()+5);return{top:b.pageY,left:a}},_setUpCloseBehavior:function(){var b=this;var a=function(c){c.one("click.close_popup",function(){b.remove()})};a($(window.document));a($(window.top.document));_.each(window.top.frames,function(c){a($(c.document))})},addItem:function(b,a){a=(a>=0)?a:this.options.length;this.options.splice(a,0,b);return this},removeItem:function(a){if(a>=0){this.options.splice(a,1)}return this},findIndexByHtml:function(b){for(var a=0;a<this.options.length;a++){if(_.has(this.options[a],"html")&&(this.options[a].html===b)){return a}}return null},findItemByHtml:function(a){return this.options[(this.findIndexByHtml(a))]},toString:function(){return"PopupMenu"}});PopupMenu.make_popupmenu=function(b,c){var a=[];_.each(c,function(f,d){var e={html:d};if(f===null){e.header=true}else{if(jQuery.type(f)==="function"){e.func=f}}a.push(e)});return new PopupMenu($(b),a)};PopupMenu.convertLinksToOptions=function(c,a){c=$(c);a=a||"a";var b=[];c.find(a).each(function(g,e){var f={},d=$(g);f.html=d.text();if(d.attr("href")){var j=d.attr("href"),k=d.attr("target"),h=d.attr("confirm");f.func=function(){if((h)&&(!confirm(h))){return}switch(k){case"_parent":window.parent.location=j;break;case"_top":window.top.location=j;break;default:window.location=j}}}b.push(f)});return b};PopupMenu.fromExistingDom=function(d,c,a){d=$(d);c=$(c);var b=PopupMenu.convertLinksToOptions(c,a);c.remove();return new PopupMenu(d,b)};PopupMenu.make_popup_menus=function(c,b,d){c=c||document;b=b||"div[popupmenu]";d=d||function(e,f){return"#"+e.attr("popupmenu")};var a=[];$(c).find(b).each(function(){var e=$(this),f=$(c).find(d(e,c));a.push(PopupMenu.fromDom(f,e));f.addClass("popup")});return a};var faIconButton=function(a){a=a||{};a.tooltipConfig=a.tooltipConfig||{placement:"bottom"};a.classes=["icon-btn"].concat(a.classes||[]);if(a.disabled){a.classes.push("disabled")}var b=['<a class="',a.classes.join(" "),'"',((a.title)?(' title="'+a.title+'"'):("")),((a.target)?(' target="'+a.target+'"'):("")),' href="',((a.href)?(a.href):("javascript:void(0);")),'">','<span class="fa ',a.faIcon,'"></span>',"</a>"].join("");var c=$(b).tooltip(a.tooltipConfig);if(_.isFunction(a.onclick)){c.click(a.onclick)}return c};var searchInput=function(k){var a=27,h=13,i=$("<div/>"),b={initialVal:"",name:"search",placeholder:"search",classes:"",onclear:function(){},onsearch:function(l){},minSearchLen:0,escWillClear:true,oninit:function(){}};if(jQuery.type(k)==="object"){k=jQuery.extend(true,b,k)}function d(l){var m=$(this).parent().children("input");m.val("");m.trigger("clear:searchInput");k.onclear()}function j(m,l){$(this).trigger("search:searchInput",l);k.onsearch(l)}function c(){return['<input type="text" name="',k.name,'" placeholder="',k.placeholder,'" ','class="search-query ',k.classes,'" ',"/>"].join("")}function g(){return $(c()).css({width:"100%","padding-right":"24px"}).focus(function(l){$(this).select()}).keyup(function(m){if(m.which===a&&k.escWillClear){d.call(this,m)}else{var l=$(this).val();if((m.which===h)||(k.minSearchLen&&l.length>=k.minSearchLen)){j.call(this,m,l)}else{if(!l.length){d.call(this,m)}}}}).val(k.initialVal)}function f(){return'<span class="search-clear fa fa-times-circle"></span>'}function e(){return $(f()).css({position:"absolute",right:"15px","font-size":"1.4em","line-height":"23px",color:"grey"}).click(function(l){d.call(this,l)})}return i.append([g(),e()])};function LoadingIndicator(a,c){var b=this;c=jQuery.extend({cover:false},c||{});function d(){var e=['<div class="loading-indicator">','<div class="loading-indicator-text">','<span class="fa fa-spinner fa-spin fa-lg"></span>','<span class="loading-indicator-message">loading...</span>',"</div>","</div>"].join("\n");var g=$(e).hide().css(c.css||{position:"fixed"}),f=g.children(".loading-indicator-text");if(c.cover){g.css({"z-index":2,top:a.css("top"),bottom:a.css("bottom"),left:a.css("left"),right:a.css("right"),opacity:0.5,"background-color":"white","text-align":"center"});f=g.children(".loading-indicator-text").css({"margin-top":"20px"})}else{f=g.children(".loading-indicator-text").css({margin:"12px 0px 0px 10px",opacity:"0.85",color:"grey"});f.children(".loading-indicator-message").css({margin:"0px 8px 0px 0px","font-style":"italic"})}return g}b.show=function(f,e,g){f=f||"loading...";e=e||"fast";b.$indicator=d().insertBefore(a);b.message(f);b.$indicator.fadeIn(e,g);return b};b.message=function(e){b.$indicator.find("i").text(e)};b.hide=function(e,f){e=e||"fast";if(b.$indicator&&b.$indicator.size()){b.$indicator.fadeOut(e,function(){b.$indicator.remove();if(f){f()}})}else{if(f){f()}}return b};return b};
\ No newline at end of file
+var IconButton=Backbone.Model.extend({defaults:{title:"",icon_class:"",on_click:null,menu_options:null,is_menu_button:true,id:null,href:null,target:null,enabled:true,visible:true,tooltip_config:{}}});var IconButtonView=Backbone.View.extend({initialize:function(){this.model.attributes.tooltip_config={placement:"bottom"};this.model.bind("change",this.render,this)},render:function(){this.$el.tooltip("hide");var a=this.template(this.model.toJSON());a.tooltip(this.model.get("tooltip_config"));this.$el.replaceWith(a);this.setElement(a);return this},events:{click:"click"},click:function(a){if(_.isFunction(this.model.get("on_click"))){this.model.get("on_click")(a);return false}return true},template:function(b){var a='title="'+b.title+'" class="icon-button';if(b.is_menu_button){a+=" menu-button"}a+=" "+b.icon_class;if(!b.enabled){a+="_disabled"}a+='"';if(b.id){a+=' id="'+b.id+'"'}a+=' href="'+b.href+'"';if(b.target){a+=' target="'+b.target+'"'}if(!b.visible){a+=' style="display: none;"'}if(b.enabled){a="<a "+a+"/>"}else{a="<span "+a+"/>"}return $(a)}});var IconButtonCollection=Backbone.Collection.extend({model:IconButton});var IconButtonMenuView=Backbone.View.extend({tagName:"div",initialize:function(){this.render()},render:function(){var a=this;this.collection.each(function(d){var b=$("<a/>").attr("href","javascript:void(0)").attr("title",d.attributes.title).addClass("icon-button menu-button").addClass(d.attributes.icon_class).appendTo(a.$el).click(d.attributes.on_click);if(d.attributes.tooltip_config){b.tooltip(d.attributes.tooltip_config)}var c=d.get("options");if(c){make_popupmenu(b,c)}});return this}});var create_icon_buttons_menu=function(b,a){if(!a){a={}}var c=new IconButtonCollection(_.map(b,function(d){return new IconButton(_.extend(d,a))}));return new IconButtonMenuView({collection:c})};var Grid=Backbone.Collection.extend({});var GridView=Backbone.View.extend({});var PopupMenu=Backbone.View.extend({initialize:function(b,a){this.$button=b||$("<div/>");this.options=a||[];var c=this;this.$button.click(function(d){$(".popmenu-wrapper").remove();c._renderAndShow(d);return false})},_renderAndShow:function(a){this.render();this.$el.appendTo("body").css(this._getShownPosition(a)).show();this._setUpCloseBehavior()},render:function(){this.$el.addClass("popmenu-wrapper").hide().css({position:"absolute"}).html(this.template(this.$button.attr("id"),this.options));if(this.options.length){var a=this;this.$el.find("li").each(function(c,b){var d=a.options[c];if(d.func){$(this).children("a.popupmenu-option").click(function(e){d.func.call(a,e,d)})}})}return this},template:function(b,a){return['<ul id="',b,'-menu" class="dropdown-menu">',this._templateOptions(a),"</ul>"].join("")},_templateOptions:function(a){if(!a.length){return"<li>(no options)</li>"}return _.map(a,function(d){if(d.divider){return'<li class="divider"></li>'}else{if(d.header){return['<li class="head"><a href="javascript:void(0);">',d.html,"</a></li>"].join("")}}var c=d.href||"javascript:void(0);",e=(d.target)?(' target="'+d.target+'"'):(""),b=(d.checked)?('<span class="fa fa-check"></span>'):("");return['<li><a class="popupmenu-option" href="',c,'"',e,">",b,d.html,"</a></li>"].join("")}).join("")},_getShownPosition:function(b){var c=this.$el.width();var a=b.pageX-c/2;a=Math.min(a,$(document).scrollLeft()+$(window).width()-c-5);a=Math.max(a,$(document).scrollLeft()+5);return{top:b.pageY,left:a}},_setUpCloseBehavior:function(){var b=this;function a(c){$(document).off("click.close_popup");if(window.parent!==window){$(window.parent.document).off("click.close_popup")}else{$("iframe#galaxy_main").contents().off("click.close_popup")}b.remove()}$("html").one("click.close_popup",a);if(window.parent!==window){$(window.parent.document).find("html").one("click.close_popup",a)}else{$("iframe#galaxy_main").contents().one("click.close_popup",a)}},addItem:function(b,a){a=(a>=0)?a:this.options.length;this.options.splice(a,0,b);return this},removeItem:function(a){if(a>=0){this.options.splice(a,1)}return this},findIndexByHtml:function(b){for(var a=0;a<this.options.length;a++){if(_.has(this.options[a],"html")&&(this.options[a].html===b)){return a}}return null},findItemByHtml:function(a){return this.options[(this.findIndexByHtml(a))]},toString:function(){return"PopupMenu"}});PopupMenu.make_popupmenu=function(b,c){var a=[];_.each(c,function(f,d){var e={html:d};if(f===null){e.header=true}else{if(jQuery.type(f)==="function"){e.func=f}}a.push(e)});return new PopupMenu($(b),a)};PopupMenu.convertLinksToOptions=function(c,a){c=$(c);a=a||"a";var b=[];c.find(a).each(function(g,e){var f={},d=$(g);f.html=d.text();if(d.attr("href")){var j=d.attr("href"),k=d.attr("target"),h=d.attr("confirm");f.func=function(){if((h)&&(!confirm(h))){return}switch(k){case"_parent":window.parent.location=j;break;case"_top":window.top.location=j;break;default:window.location=j}}}b.push(f)});return b};PopupMenu.fromExistingDom=function(d,c,a){d=$(d);c=$(c);var b=PopupMenu.convertLinksToOptions(c,a);c.remove();return new PopupMenu(d,b)};PopupMenu.make_popup_menus=function(c,b,d){c=c||document;b=b||"div[popupmenu]";d=d||function(e,f){return"#"+e.attr("popupmenu")};var a=[];$(c).find(b).each(function(){var e=$(this),f=$(c).find(d(e,c));a.push(PopupMenu.fromDom(f,e));f.addClass("popup")});return a};var faIconButton=function(a){a=a||{};a.tooltipConfig=a.tooltipConfig||{placement:"bottom"};a.classes=["icon-btn"].concat(a.classes||[]);if(a.disabled){a.classes.push("disabled")}var b=['<a class="',a.classes.join(" "),'"',((a.title)?(' title="'+a.title+'"'):("")),((a.target)?(' target="'+a.target+'"'):("")),' href="',((a.href)?(a.href):("javascript:void(0);")),'">','<span class="fa ',a.faIcon,'"></span>',"</a>"].join("");var c=$(b).tooltip(a.tooltipConfig);if(_.isFunction(a.onclick)){c.click(a.onclick)}return c};var searchInput=function(k){var a=27,h=13,i=$("<div/>"),b={initialVal:"",name:"search",placeholder:"search",classes:"",onclear:function(){},onsearch:function(l){},minSearchLen:0,escWillClear:true,oninit:function(){}};if(jQuery.type(k)==="object"){k=jQuery.extend(true,b,k)}function d(l){var m=$(this).parent().children("input");m.val("");m.trigger("clear:searchInput");k.onclear()}function j(m,l){$(this).trigger("search:searchInput",l);k.onsearch(l)}function c(){return['<input type="text" name="',k.name,'" placeholder="',k.placeholder,'" ','class="search-query ',k.classes,'" ',"/>"].join("")}function g(){return $(c()).css({width:"100%","padding-right":"24px"}).focus(function(l){$(this).select()}).keyup(function(m){if(m.which===a&&k.escWillClear){d.call(this,m)}else{var l=$(this).val();if((m.which===h)||(k.minSearchLen&&l.length>=k.minSearchLen)){j.call(this,m,l)}else{if(!l.length){d.call(this,m)}}}}).val(k.initialVal)}function f(){return'<span class="search-clear fa fa-times-circle"></span>'}function e(){return $(f()).css({position:"absolute",right:"15px","font-size":"1.4em","line-height":"23px",color:"grey"}).click(function(l){d.call(this,l)})}return i.append([g(),e()])};function LoadingIndicator(a,c){var b=this;c=jQuery.extend({cover:false},c||{});function d(){var e=['<div class="loading-indicator">','<div class="loading-indicator-text">','<span class="fa fa-spinner fa-spin fa-lg"></span>','<span class="loading-indicator-message">loading...</span>',"</div>","</div>"].join("\n");var g=$(e).hide().css(c.css||{position:"fixed"}),f=g.children(".loading-indicator-text");if(c.cover){g.css({"z-index":2,top:a.css("top"),bottom:a.css("bottom"),left:a.css("left"),right:a.css("right"),opacity:0.5,"background-color":"white","text-align":"center"});f=g.children(".loading-indicator-text").css({"margin-top":"20px"})}else{f=g.children(".loading-indicator-text").css({margin:"12px 0px 0px 10px",opacity:"0.85",color:"grey"});f.children(".loading-indicator-message").css({margin:"0px 8px 0px 0px","font-style":"italic"})}return g}b.show=function(f,e,g){f=f||"loading...";e=e||"fast";b.$indicator=d().insertBefore(a);b.message(f);b.$indicator.fadeIn(e,g);return b};b.message=function(e){b.$indicator.find("i").text(e)};b.hide=function(e,f){e=e||"fast";if(b.$indicator&&b.$indicator.size()){b.$indicator.fadeOut(e,function(){b.$indicator.remove();if(f){f()}})}else{if(f){f()}}return b};return b};
\ No newline at end of file
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: greg: More code cleanup and fixes for the tool shed's install and test framework. The test environment information for both the tool shed and Galaxy should now be stored correctly in the Tool test results container on the view or manage repository page in the tool shed.
by commits-noreply@bitbucket.org 26 Nov '13
by commits-noreply@bitbucket.org 26 Nov '13
26 Nov '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/6fc4a1141845/
Changeset: 6fc4a1141845
User: greg
Date: 2013-11-26 17:40:25
Summary: More code cleanup and fixes for the tool shed's install and test framework. The test environment information for both the tool shed and Galaxy should now be stored correctly in the Tool test results container on the view or manage repository page in the tool shed.
Affected #: 4 files
diff -r 4cfffc6fce30b9dd89849975c473e188936318ad -r 6fc4a11418458903a35aac3fd4878ab6c4265483 lib/galaxy/webapps/tool_shed/api/repository_revisions.py
--- a/lib/galaxy/webapps/tool_shed/api/repository_revisions.py
+++ b/lib/galaxy/webapps/tool_shed/api/repository_revisions.py
@@ -143,7 +143,8 @@
# Example URL: http://localhost:9009/api/repository_revisions/bb125606ff9ea620
try:
repository_metadata = metadata_util.get_repository_metadata_by_id( trans, id )
- repository_metadata_dict = repository_metadata.to_dict( value_mapper=self.__get_value_mapper( trans, repository_metadata ) )
+ repository_metadata_dict = repository_metadata.to_dict( view='element',
+ value_mapper=self.__get_value_mapper( trans, repository_metadata ) )
repository_metadata_dict[ 'url' ] = web.url_for( controller='repository_revisions',
action='show',
id=trans.security.encode_id( repository_metadata.id ) )
@@ -180,7 +181,8 @@
log.error( message, exc_info=True )
trans.response.status = 500
return message
- repository_metadata_dict = repository_metadata.to_dict( value_mapper=self.__get_value_mapper( trans, repository_metadata ) )
+ repository_metadata_dict = repository_metadata.to_dict( view='element',
+ value_mapper=self.__get_value_mapper( trans, repository_metadata ) )
repository_metadata_dict[ 'url' ] = web.url_for( controller='repository_revisions',
action='show',
id=trans.security.encode_id( repository_metadata.id ) )
diff -r 4cfffc6fce30b9dd89849975c473e188936318ad -r 6fc4a11418458903a35aac3fd4878ab6c4265483 lib/galaxy/webapps/tool_shed/model/__init__.py
--- a/lib/galaxy/webapps/tool_shed/model/__init__.py
+++ b/lib/galaxy/webapps/tool_shed/model/__init__.py
@@ -251,7 +251,7 @@
self.do_not_test = do_not_test
self.test_install_error = test_install_error
self.time_last_tested = time_last_tested
- self.tool_test_results = tool_test_results
+ self.tool_test_results = tool_test_results or dict()
self.has_repository_dependencies = has_repository_dependencies
# We don't consider the special case has_repository_dependencies_only_if_compiling_contained_td here.
self.includes_datatypes = includes_datatypes
diff -r 4cfffc6fce30b9dd89849975c473e188936318ad -r 6fc4a11418458903a35aac3fd4878ab6c4265483 lib/tool_shed/scripts/check_repositories_for_functional_tests.py
--- a/lib/tool_shed/scripts/check_repositories_for_functional_tests.py
+++ b/lib/tool_shed/scripts/check_repositories_for_functional_tests.py
@@ -1,16 +1,10 @@
#!/usr/bin/env python
-import ConfigParser
-import logging
+
import os
-import shutil
import sys
-import tempfile
-import time
-from optparse import OptionParser
-from time import strftime
-
-new_path = [ os.path.join( os.getcwd(), "lib" ), os.path.join( os.getcwd(), "test" ) ]
+new_path = [ os.path.join( os.getcwd(), "lib" ),
+ os.path.join( os.getcwd(), "test" ) ]
new_path.extend( sys.path[ 1: ] )
sys.path = new_path
@@ -18,48 +12,56 @@
eggs.require( "SQLAlchemy >= 0.4" )
eggs.require( 'mercurial' )
+import ConfigParser
import galaxy.webapps.tool_shed.config as tool_shed_config
import galaxy.webapps.tool_shed.model.mapping
+import logging
+import shutil
+import tempfile
+import time
-from base.util import get_test_environment
from base.util import get_database_version
from base.util import get_repository_current_revision
-from galaxy.model.orm import and_, not_, select
+from galaxy.model.orm import and_
+from galaxy.model.orm import not_
+from galaxy.model.orm import select
from mercurial import hg
from mercurial import ui
from mercurial import __version__
+from optparse import OptionParser
+from time import strftime
from tool_shed.util.shed_util_common import clone_repository
from tool_shed.util.shed_util_common import get_configured_ui
-log = logging.getLogger()
-log.setLevel( 10 )
-log.addHandler( logging.StreamHandler( sys.stdout ) )
-
+log = logging.getLogger( 'check_repositories_for_functional_tests' )
assert sys.version_info[ :2 ] >= ( 2, 6 )
-class FlagRepositoriesApplication( object ):
- """Encapsulates the state of a Universe application"""
+class RepositoryMetadataApplication( object ):
+ """Application that enables updating repository_metadata table records in the Tool Shed."""
+
def __init__( self, config ):
if config.database_connection is False:
- config.database_connection = "sqlite:///%s?isolation_level=IMMEDIATE" % config.database
+ config.database_connection = "sqlite:///%s?isolation_level=IMMEDIATE" % str( config.database )
+ log.debug( 'Using database connection: %s' % str( config.database_connection ) )
# Setup the database engine and ORM
- self.model = galaxy.webapps.tool_shed.model.mapping.init( config.file_path, config.database_connection, engine_options={}, create_tables=False )
+ self.model = galaxy.webapps.tool_shed.model.mapping.init( config.file_path,
+ config.database_connection,
+ engine_options={},
+ create_tables=False )
self.hgweb_config_manager = self.model.hgweb_config_manager
self.hgweb_config_manager.hgweb_config_dir = config.hgweb_config_dir
- print "# Using configured hgweb.config file: ", self.hgweb_config_manager.hgweb_config
+ log.debug( 'Using hgweb.config file: %s' % str( self.hgweb_config_manager.hgweb_config ) )
+
@property
def sa_session( self ):
- """
- Returns a SQLAlchemy session -- currently just gets the current
- session from the threadlocal session context, but this is provided
- to allow migration toward a more SQLAlchemy 0.4 style of use.
- """
+ """Returns a SQLAlchemy session."""
return self.model.context.current
+
def shutdown( self ):
pass
-def check_and_flag_repositories( app, info_only=False, verbosity=1 ):
+def check_and_update_repository_metadata( app, info_only=False, verbosity=1 ):
"""
This method will iterate through all records in the repository_metadata table, checking each one for tool metadata,
then checking the tool metadata for tests. Each tool's metadata should look something like:
@@ -352,12 +354,12 @@
print "# %s - Checking repositories for tools with functional tests." % now
print "# This tool shed is configured to listen on %s:%s." % ( config_parser.get( config_section, 'host' ),
config_parser.get( config_section, 'port' ) )
- app = FlagRepositoriesApplication( config )
+ app = RepositoryMetadataApplication( config )
if options.info_only:
print "# Displaying info only ( --info_only )"
if options.verbosity:
print "# Displaying extra information ( --verbosity = %d )" % options.verbosity
- check_and_flag_repositories( app, info_only=options.info_only, verbosity=options.verbosity )
+ check_and_update_repository_metadata( app, info_only=options.info_only, verbosity=options.verbosity )
def should_set_do_not_test_flag( app, repository, changeset_revision ):
'''
diff -r 4cfffc6fce30b9dd89849975c473e188936318ad -r 6fc4a11418458903a35aac3fd4878ab6c4265483 test/install_and_test_tool_shed_repositories/functional_tests.py
--- a/test/install_and_test_tool_shed_repositories/functional_tests.py
+++ b/test/install_and_test_tool_shed_repositories/functional_tests.py
@@ -1,32 +1,70 @@
#!/usr/bin/env python
+"""
+This script cannot be run directly, because it needs to have test/functional/test_toolbox.py in sys.argv in
+order to run functional tests on repository tools after installation. The install_and_test_tool_shed_repositories.sh
+will execute this script with the appropriate parameters.
+"""
+import os
+import sys
+# Assume we are run from the galaxy root directory, add lib to the python path
+cwd = os.getcwd()
+sys.path.append( cwd )
+new_path = [ os.path.join( cwd, "scripts" ),
+ os.path.join( cwd, "lib" ),
+ os.path.join( cwd, 'test' ),
+ os.path.join( cwd, 'scripts', 'api' ) ]
+new_path.extend( sys.path )
+sys.path = new_path
-# NOTE: This script cannot be run directly, because it needs to have test/functional/test_toolbox.py in sys.argv in
-# order to run functional tests on repository tools after installation. The install_and_test_tool_shed_repositories.sh
-# will execute this script with the appropriate parameters.
+from galaxy import eggs
+eggs.require( "nose" )
+eggs.require( "Paste" )
+eggs.require( 'mercurial' )
+# This should not be required, but it is under certain conditions thanks to this bug:
+# http://code.google.com/p/python-nose/issues/detail?id=284
+eggs.require( "pysqlite" )
-import atexit
+import functional.test_toolbox as test_toolbox
import httplib
+import install_and_test_tool_shed_repositories.base.test_db_util as test_db_util
+import install_and_test_tool_shed_repositories.functional.test_install_repositories as test_install_repositories
import logging
-import os
-import os.path
-import platform
+import nose
import random
import re
import shutil
import socket
import string
-import sys
import tempfile
import time
import threading
-import unittest
+import tool_shed.util.shed_util_common as suc
import urllib
+
+from base.util import get_database_version
+from base.util import get_repository_current_revision
+from base.util import get_test_environment
+from base.util import parse_tool_panel_config
+from common import update
+from datetime import datetime
+from galaxy.app import UniverseApplication
+from galaxy.util import asbool
+from galaxy.util import unicodify
+from galaxy.util.json import from_json_string
+from galaxy.util.json import to_json_string
+from galaxy.web import buildapp
+from galaxy.web.framework.helpers import time_ago
+from functional_tests import generate_config_file
+from mercurial import __version__
+from nose.plugins import Plugin
+from paste import httpserver
from time import strftime
+from tool_shed.util import tool_dependency_util
+from tool_shed.util.xml_util import parse_xml
-# Assume we are run from the galaxy root directory, add lib to the python path
-cwd = os.getcwd()
-sys.path.append( cwd )
+log = logging.getLogger( 'install_and_test_repositories' )
+assert sys.version_info[ :2 ] >= ( 2, 6 )
test_home_directory = os.path.join( cwd, 'test', 'install_and_test_tool_shed_repositories' )
default_test_file_dir = os.path.join( test_home_directory, 'test_data' )
@@ -36,134 +74,15 @@
default_galaxy_locales = 'en'
default_galaxy_test_file_dir = "test-data"
os.environ[ 'GALAXY_INSTALL_TEST_TMP_DIR' ] = galaxy_test_tmp_dir
-new_path = [ os.path.join( cwd, "scripts" ), os.path.join( cwd, "lib" ), os.path.join( cwd, 'test' ), os.path.join( cwd, 'scripts', 'api' ) ]
-new_path.extend( sys.path )
-sys.path = new_path
-
-from functional_tests import generate_config_file
-
-from galaxy import eggs
-
-eggs.require( "nose" )
-eggs.require( "NoseHTML" )
-eggs.require( "NoseTestDiff" )
-eggs.require( "twill==0.9" )
-eggs.require( "Paste" )
-eggs.require( "PasteDeploy" )
-eggs.require( "Cheetah" )
-eggs.require( "simplejson" )
-eggs.require( 'mercurial' )
-
-import simplejson
-import twill
-
-from datetime import datetime
-from mercurial import __version__
-
-# This should not be required, but it is under certain conditions, thanks to this bug: http://code.google.com/p/python-nose/issues/detail?id=284
-eggs.require( "pysqlite" )
-
-import install_and_test_tool_shed_repositories.functional.test_install_repositories as test_install_repositories
-import install_and_test_tool_shed_repositories.base.test_db_util as test_db_util
-import functional.test_toolbox as test_toolbox
-
-from paste import httpserver
-
-# This is for the galaxy application.
-import galaxy.app
-from galaxy.app import UniverseApplication
-from galaxy.web import buildapp
-from galaxy.util import parse_xml, asbool
-from galaxy.util.json import from_json_string, to_json_string
-
-import tool_shed.util.shed_util_common as suc
-from tool_shed.util import tool_dependency_util
-
-from galaxy.web.framework.helpers import time_ago
-
-import nose.core
-import nose.config
-import nose.loader
-import nose.plugins.manager
-from nose.plugins import Plugin
-
-from base.util import get_database_version
-from base.util import get_repository_current_revision
-from base.util import get_test_environment
-from base.util import parse_tool_panel_config
-
-from galaxy.util import unicodify
-
-from common import update
-
-log = logging.getLogger( 'install_and_test_repositories' )
default_galaxy_test_port_min = 10000
default_galaxy_test_port_max = 10999
default_galaxy_test_host = '127.0.0.1'
default_galaxy_master_api_key = None
-# should this serve static resources (scripts, images, styles, etc.)
+# Should this serve static resources (scripts, images, styles, etc.)?
STATIC_ENABLED = True
-def get_static_settings():
- """Returns dictionary of the settings necessary for a galaxy App
- to be wrapped in the static middleware.
-
- This mainly consists of the filesystem locations of url-mapped
- static resources.
- """
- cwd = os.getcwd()
- static_dir = os.path.join( cwd, 'static' )
- #TODO: these should be copied from universe_wsgi.ini
- return dict(
- #TODO: static_enabled needed here?
- static_enabled = True,
- static_cache_time = 360,
- static_dir = static_dir,
- static_images_dir = os.path.join( static_dir, 'images', '' ),
- static_favicon_dir = os.path.join( static_dir, 'favicon.ico' ),
- static_scripts_dir = os.path.join( static_dir, 'scripts', '' ),
- static_style_dir = os.path.join( static_dir, 'june_2007_style', 'blue' ),
- static_robots_txt = os.path.join( static_dir, 'robots.txt' ),
- )
-
-def get_webapp_global_conf():
- """Get the global_conf dictionary sent as the first argument to app_factory.
- """
- # (was originally sent '{}') - nothing here for now except static settings
- global_conf = {}
- if STATIC_ENABLED:
- global_conf.update( get_static_settings() )
- return global_conf
-
-# Optionally, set the environment variable GALAXY_INSTALL_TEST_TOOL_SHEDS_CONF
-# to the location of a tool sheds configuration file that includes the tool shed
-# that repositories will be installed from.
-
-tool_sheds_conf_xml = '''<?xml version="1.0"?>
-<tool_sheds>
- <tool_shed name="Galaxy main tool shed" url="http://toolshed.g2.bx.psu.edu/"/>
- <tool_shed name="Galaxy test tool shed" url="http://testtoolshed.g2.bx.psu.edu/"/>
-</tool_sheds>
-'''
-
-# Create a blank shed_tool_conf.xml to hold the installed repositories.
-shed_tool_conf_xml_template = '''<?xml version="1.0"?>
-<toolbox tool_path="${shed_tool_path}">
-</toolbox>
-'''
-
-# Since we will be running functional tests, we'll need the upload tool, but the rest can be omitted.
-tool_conf_xml = '''<?xml version="1.0"?>
-<toolbox>
- <section name="Get Data" id="getext">
- <tool file="data_source/upload.xml"/>
- </section>
-</toolbox>
-'''
-
-
job_conf_xml = '''<?xml version="1.0"?><!-- A test job config that explicitly configures job running the way it is configured by default (if there is no explicit config). --><job_conf>
@@ -182,17 +101,48 @@
</job_conf>
'''
+# Create a blank shed_tool_conf.xml to define the installed repositories.
+shed_tool_conf_xml_template = '''<?xml version="1.0"?>
+<toolbox tool_path="${shed_tool_path}">
+</toolbox>
+'''
+
+# Since we will be running functional tests we'll need the upload tool, but the rest can be omitted.
+tool_conf_xml = '''<?xml version="1.0"?>
+<toolbox>
+ <section name="Get Data" id="getext">
+ <tool file="data_source/upload.xml"/>
+ </section>
+</toolbox>
+'''
+
+# Set up an empty shed_tool_data_table_conf.xml.
+tool_data_table_conf_xml_template = '''<?xml version="1.0"?>
+<tables>
+</tables>
+'''
+
+# Optionally set the environment variable GALAXY_INSTALL_TEST_TOOL_SHEDS_CONF to the location of a
+# tool shed's configuration file that includes the tool shed from which repositories will be installed.
+tool_sheds_conf_xml = '''<?xml version="1.0"?>
+<tool_sheds>
+ <tool_shed name="Galaxy main tool shed" url="http://toolshed.g2.bx.psu.edu/"/>
+ <tool_shed name="Galaxy test tool shed" url="http://testtoolshed.g2.bx.psu.edu/"/>
+</tool_sheds>
+'''
+
# If we have a tool_data_table_conf.test.xml, set it up to be loaded when the UniverseApplication is started.
# This allows one to specify a set of tool data that is used exclusively for testing, and not loaded into any
# Galaxy instance. By default, this will be in the test-data-repo/location directory generated by buildbot_setup.sh.
if os.path.exists( 'tool_data_table_conf.test.xml' ):
additional_tool_data_tables = 'tool_data_table_conf.test.xml'
- additional_tool_data_path = os.environ.get( 'GALAXY_INSTALL_TEST_EXTRA_TOOL_DATA_PATH', os.path.join( 'test-data-repo', 'location' ) )
+ additional_tool_data_path = os.environ.get( 'GALAXY_INSTALL_TEST_EXTRA_TOOL_DATA_PATH',
+ os.path.join( 'test-data-repo', 'location' ) )
else:
additional_tool_data_tables = None
additional_tool_data_path = None
-# Also set up default tool data tables.
+# Set up default tool data tables.
if os.path.exists( 'tool_data_table_conf.xml' ):
tool_data_table_conf = 'tool_data_table_conf.xml'
elif os.path.exists( 'tool_data_table_conf.xml.sample' ):
@@ -200,28 +150,14 @@
else:
tool_data_table_conf = None
-# And set up a blank shed_tool_data_table_conf.xml.
-tool_data_table_conf_xml_template = '''<?xml version="1.0"?>
-<tables>
-</tables>
-'''
-
-# The tool shed url and api key must be set for this script to work correctly. Additionally, if the tool shed url does not
-# point to one of the defaults, the GALAXY_INSTALL_TEST_TOOL_SHEDS_CONF needs to point to a tool sheds configuration file
-# that contains a definition for that tool shed.
-
+# The GALAXY_INSTALL_TEST_TOOL_SHED_URL and GALAXY_INSTALL_TEST_TOOL_SHED_API_KEY environment variables must be
+# set for this script to work correctly. If the value of GALAXY_INSTALL_TEST_TOOL_SHED_URL does not refer to one
+# of the defaults, the GALAXY_INSTALL_TEST_TOOL_SHEDS_CONF must refer to a tool shed configuration file that contains
+# a definition for that tool shed.
galaxy_tool_shed_url = os.environ.get( 'GALAXY_INSTALL_TEST_TOOL_SHED_URL', None )
tool_shed_api_key = os.environ.get( 'GALAXY_INSTALL_TEST_TOOL_SHED_API_KEY', None )
exclude_list_file = os.environ.get( 'GALAXY_INSTALL_TEST_EXCLUDE_REPOSITORIES', 'install_test_exclude.xml' )
-if tool_shed_api_key is None:
- print "This script requires the GALAXY_INSTALL_TEST_TOOL_SHED_API_KEY environment variable to be set and non-empty."
- exit( 1 )
-
-if galaxy_tool_shed_url is None:
- print "This script requires the GALAXY_INSTALL_TEST_TOOL_SHED_URL environment variable to be set and non-empty."
- exit( 1 )
-
if 'GALAXY_INSTALL_TEST_SECRET' not in os.environ:
galaxy_encode_secret = 'changethisinproductiontoo'
os.environ[ 'GALAXY_INSTALL_TEST_SECRET' ] = galaxy_encode_secret
@@ -237,6 +173,7 @@
else:
testing_single_repository[ 'changeset_revision' ] = None
+
class ReportResults( Plugin ):
'''Simple Nose plugin to record the IDs of all tests run, regardless of success.'''
name = "reportresults"
@@ -481,6 +418,24 @@
str( repository_dict.get( 'owner', None ) ) ) )
return repository_dicts, error_message
+def get_static_settings():
+ """
+ Return a dictionary of the settings necessary for a Galaxy application to be wrapped in the static
+ middleware. This mainly consists of the file system locations of url-mapped static resources.
+ """
+ cwd = os.getcwd()
+ static_dir = os.path.join( cwd, 'static' )
+ #TODO: these should be copied from universe_wsgi.ini
+ #TODO: static_enabled needed here?
+ return dict( static_enabled = True,
+ static_cache_time = 360,
+ static_dir = static_dir,
+ static_images_dir = os.path.join( static_dir, 'images', '' ),
+ static_favicon_dir = os.path.join( static_dir, 'favicon.ico' ),
+ static_scripts_dir = os.path.join( static_dir, 'scripts', '' ),
+ static_style_dir = os.path.join( static_dir, 'june_2007_style', 'blue' ),
+ static_robots_txt = os.path.join( static_dir, 'robots.txt' ) )
+
def get_tool_info_from_test_id( test_id ):
"""
Test IDs come in the form test_tool_number
@@ -500,8 +455,17 @@
if error_message:
return None, error_message
tool_test_results = repository_metadata.get( 'tool_test_results', {} )
+ if tool_test_results is None:
+ return None, error_message
return tool_test_results, error_message
+def get_webapp_global_conf():
+ """Return the global_conf dictionary sent as the first argument to app_factory."""
+ global_conf = {}
+ if STATIC_ENABLED:
+ global_conf.update( get_static_settings() )
+ return global_conf
+
def handle_missing_dependencies( app, repository, missing_tool_dependencies, repository_dict, tool_test_results_dict, results_dict ):
"""Handle missing repository or tool dependencies for an installed repository."""
# If a tool dependency fails to install correctly, this should be considered an installation error,
@@ -671,7 +635,7 @@
# that are missing test components. We need to be careful to not lose this information. For all other repositories,
# no changes will have been made to this dictionary by the preparation script, and tool_test_results_dict will be None.
# Initialize the tool_test_results_dict dictionary with the information about the current test environment.
- test_environment_dict = tool_test_results_dict.get( 'test_environent', None )
+ test_environment_dict = tool_test_results_dict.get( 'test_environment', None )
test_environment_dict = get_test_environment( test_environment_dict )
test_environment_dict[ 'galaxy_database_version' ] = get_database_version( app )
test_environment_dict[ 'galaxy_revision' ] = get_repository_current_revision( os.getcwd() )
@@ -772,261 +736,21 @@
return None, error_message
return parsed_json, error_message
-def parse_exclude_list( xml_filename ):
- """Return a list of repositories to exclude from testing."""
- # This method should return a list with the following structure:
- # [{ 'reason': The default reason or the reason specified in this section,
- # 'repositories': [( name, owner, changeset revision if changeset revision else None ),
- # ( name, owner, changeset revision if changeset revision else None )]}]
- exclude_list = []
- exclude_verbose = []
- xml_tree = parse_xml( xml_filename )
- tool_sheds = xml_tree.findall( 'repositories' )
- xml_element = []
- exclude_count = 0
- for tool_shed in tool_sheds:
- if galaxy_tool_shed_url != tool_shed.attrib[ 'tool_shed' ]:
- continue
- else:
- xml_element = tool_shed
- for reason_section in xml_element:
- reason_text = reason_section.find( 'text' ).text
- repositories = reason_section.findall( 'repository' )
- exclude_dict = dict( reason=reason_text, repositories=[] )
- for repository in repositories:
- repository_tuple = get_repository_tuple_from_elem( repository )
- if repository_tuple not in exclude_dict[ 'repositories' ]:
- exclude_verbose.append( repository_tuple )
- exclude_count += 1
- exclude_dict[ 'repositories' ].append( repository_tuple )
- exclude_list.append( exclude_dict )
- log.debug( '%s repositories excluded from testing...' % str( exclude_count ) )
- if '-list_repositories' in sys.argv:
- for name, owner, changeset_revision in exclude_verbose:
- if changeset_revision:
- log.debug( 'Repository %s owned by %s, changeset revision %s.' % ( str( name ), str( owner ), str( changeset_revision ) ) )
- else:
- log.debug( 'Repository %s owned by %s, all revisions.' % ( str( name ), str( owner ) ) )
- return exclude_list
-
-def register_test_result( url, test_results_dict, repository_dict, params ):
- """
- Update the repository metadata tool_test_results and appropriate flags using the Tool SHed API. This method
- updates tool_test_results with the relevant data, sets the do_not_test and tools_functionally correct flags
- to the appropriate values and updates the time_last_tested field to the value of the received time_tested.
- """
- if '-info_only' in sys.argv or 'GALAXY_INSTALL_TEST_INFO_ONLY' in os.environ:
- return {}
- else:
- metadata_revision_id = repository_dict.get( 'id', None )
- log.debug("RRR In register_test_result, metadata_revision_id: %s" % str( metadata_revision_id ))
- if metadata_revision_id is not None:
- # Set the time_last_tested entry so that the repository_metadata.time_last_tested will be set in the tool shed.
- time_tested = datetime.utcnow()
- test_results_dict[ 'time_last_tested' ] = time_ago( time_tested )
- params[ 'tool_test_results' ] = test_results_dict
- url = '%s' % ( suc.url_join( galaxy_tool_shed_url,'api', 'repository_revisions', str( metadata_revision_id ) ) )
- try:
- return update( tool_shed_api_key, url, params, return_formatted=False )
- except Exception, e:
- log.exception( 'Error attempting to register test results: %s' % str( e ) )
- return {}
-
-def remove_generated_tests( app ):
- """
- Delete any configured tool functional tests from the test_toolbox.__dict__, otherwise nose will find them
- and try to re-run the tests after uninstalling the repository, which will cause false failure reports,
- since the test data has been deleted from disk by now.
- """
- tests_to_delete = []
- tools_to_delete = []
- global test_toolbox
- for key in test_toolbox.__dict__:
- if key.startswith( 'TestForTool_' ):
- log.debug( 'Tool test found in test_toolbox, deleting: %s' % str( key ) )
- # We can't delete this test just yet, we're still iterating over __dict__.
- tests_to_delete.append( key )
- tool_id = key.replace( 'TestForTool_', '' )
- for tool in app.toolbox.tools_by_id:
- if tool.replace( '_', ' ' ) == tool_id.replace( '_', ' ' ):
- tools_to_delete.append( tool )
- for key in tests_to_delete:
- # Now delete the tests found in the previous loop.
- del test_toolbox.__dict__[ key ]
- for tool in tools_to_delete:
- del app.toolbox.tools_by_id[ tool ]
-
-def remove_install_tests():
- """
- Delete any configured repository installation tests from the test_toolbox.__dict__, otherwise nose will find them
- and try to install the repository again while running tool functional tests.
- """
- tests_to_delete = []
- global test_toolbox
- # Push all the toolbox tests to module level
- for key in test_install_repositories.__dict__:
- if key.startswith( 'TestInstallRepository_' ):
- log.debug( 'Repository installation process found, deleting: %s' % str( key ) )
- # We can't delete this test just yet, we're still iterating over __dict__.
- tests_to_delete.append( key )
- for key in tests_to_delete:
- # Now delete the tests found in the previous loop.
- del test_install_repositories.__dict__[ key ]
-
-def run_tests( test_config ):
- loader = nose.loader.TestLoader( config=test_config )
- test_config.plugins.addPlugin( ReportResults() )
- plug_loader = test_config.plugins.prepareTestLoader( loader )
- if plug_loader is not None:
- loader = plug_loader
- tests = loader.loadTestsFromNames( test_config.testNames )
- test_runner = nose.core.TextTestRunner( stream=test_config.stream,
- verbosity=test_config.verbosity,
- config=test_config )
- plug_runner = test_config.plugins.prepareTestRunner( test_runner )
- if plug_runner is not None:
- test_runner = plug_runner
- result = test_runner.run( tests )
- return result, test_config.plugins._plugins
-
-def show_summary_output( repository_dicts ):
- repositories_by_owner = {}
- for repository in repository_dicts:
- if repository[ 'owner' ] not in repositories_by_owner:
- repositories_by_owner[ repository[ 'owner' ] ] = []
- repositories_by_owner[ repository[ 'owner' ] ].append( repository )
- for owner in repositories_by_owner:
- print "# "
- for repository in repositories_by_owner[ owner ]:
- print "# %s owned by %s, changeset revision %s" % ( repository[ 'name' ], repository[ 'owner' ], repository[ 'changeset_revision' ] )
-
-def test_repository_tools( app, repository, repository_dict, tool_test_results_dict, results_dict ):
- """Test tools contained in the received repository."""
- name = str( repository.name )
- owner = str( repository.owner )
- changeset_revision = str( repository.changeset_revision )
- # Set the module-level variable 'toolbox', so that test.functional.test_toolbox will generate the appropriate test methods.
- test_toolbox.toolbox = app.toolbox
- # Generate the test methods for this installed repository. We need to pass in True here, or it will look
- # in $GALAXY_HOME/test-data for test data, which may result in missing or invalid test files.
- test_toolbox.build_tests( testing_shed_tools=True, master_api_key=default_galaxy_master_api_key )
- # Set up nose to run the generated functional tests.
- test_config = nose.config.Config( env=os.environ, plugins=nose.plugins.manager.DefaultPluginManager() )
- test_config.configure( sys.argv )
- # Run the configured tests.
- result, test_plugins = run_tests( test_config )
- success = result.wasSuccessful()
- # Use the ReportResults nose plugin to get a list of tests that passed.
- for plugin in test_plugins:
- if hasattr( plugin, 'getTestStatus' ):
- test_identifier = '%s/%s' % ( owner, name )
- passed_tests = plugin.getTestStatus( test_identifier )
- break
- tool_test_results_dict[ 'passed_tests' ] = []
- for test_id in passed_tests:
- # Normalize the tool ID and version display.
- tool_id, tool_version = get_tool_info_from_test_id( test_id )
- test_result = dict( test_id=test_id, tool_id=tool_id, tool_version=tool_version )
- tool_test_results_dict[ 'passed_tests' ].append( test_result )
- if success:
- # This repository's tools passed all functional tests. Update the repository_metadata table in the tool shed's database
- # to reflect that. Call the register_test_result method, which executes a PUT request to the repository_revisions API
- # controller with the status of the test. This also sets the do_not_test and tools_functionally correct flags, and
- # updates the time_last_tested field to today's date.
- results_dict[ 'repositories_passed' ].append( dict( name=name, owner=owner, changeset_revision=changeset_revision ) )
- params = dict( tools_functionally_correct=True,
- do_not_test=False,
- test_install_error=False )
- register_test_result( galaxy_tool_shed_url, tool_test_results_dict, repository_dict, params )
- log.debug( 'Revision %s of repository %s installed and passed functional tests.' % ( str( changeset_revision ), str( name ) ) )
- else:
- tool_test_results_dict[ 'failed_tests' ].append( extract_log_data( result, from_tool_test=True ) )
- results_dict[ 'repositories_failed' ].append( dict( name=name, owner=owner, changeset_revision=changeset_revision ) )
- set_do_not_test = not is_latest_downloadable_revision( galaxy_tool_shed_url, repository_dict )
- params = dict( tools_functionally_correct=False,
- test_install_error=False,
- do_not_test=str( set_do_not_test ) )
- register_test_result( galaxy_tool_shed_url, tool_test_results_dict, repository_dict, params )
- log.debug( 'Revision %s of repository %s installed successfully but did not pass functional tests.' % \
- ( str( changeset_revision ), str( name ) ) )
- # Run the uninstall method. This removes tool functional test methods from the test_toolbox module and uninstalls the
- # repository using Twill.
- deactivate = asbool( os.environ.get( 'GALAXY_INSTALL_TEST_KEEP_TOOL_DEPENDENCIES', False ) )
- if deactivate:
- log.debug( 'Deactivating changeset revision %s of repository %s' % ( str( changeset_revision ), str( name ) ) )
- # We are deactivating this repository and all of its repository dependencies.
- deactivate_repository( app, repository_dict )
- else:
- log.debug( 'Uninstalling changeset revision %s of repository %s' % ( str( changeset_revision ), str( name ) ) )
- # We are uninstalling this repository and all of its repository dependencies.
- uninstall_repository( app, repository_dict )
-
- # Set the test_toolbox.toolbox module-level variable to the new app.toolbox.
- test_toolbox.toolbox = app.toolbox
- return results_dict
-
-def uninstall_repository( app, repository_dict ):
- """Attempt to uninstall a repository."""
- sa_session = app.model.context.current
- # Clean out any generated tests. This is necessary for Twill.
- remove_generated_tests( app )
- # The dict contains the only repository the app should have installed at this point.
- name = str( repository_dict[ 'name' ] )
- owner = str( repository_dict[ 'owner' ] )
- changeset_revision = str( repository_dict[ 'changeset_revision' ] )
- repository = test_db_util.get_installed_repository_by_name_owner_changeset_revision( name, owner, changeset_revision )
- # We have to do this through Twill, in order to maintain app.toolbox and shed_tool_conf.xml in a state that is valid for future tests.
- for required_repository in repository.repository_dependencies:
- repository_dict = dict( name=str( required_repository.name ),
- owner=str( required_repository.owner ),
- changeset_revision=str( required_repository.changeset_revision ) )
- # Generate a test method to uninstall this repository through the embedded Galaxy application's web interface.
- test_install_repositories.generate_deactivate_or_uninstall_method( repository_dict, deactivate=False )
- log.debug( 'Changeset revision %s of %s repository %s selected for uninstallation.' % \
- ( str( required_repository.changeset_revision ), str( required_repository.status ), str( required_repository.name ) ) )
- repository_dict = dict( name=name, owner=owner, changeset_revision=changeset_revision )
- test_install_repositories.generate_deactivate_or_uninstall_method( repository_dict, deactivate=False )
- log.debug( 'Changeset revision %s of %s repository %s selected for uninstallation.' % ( changeset_revision, str( repository.status ), name ) )
- # Set up nose to run the generated uninstall method as a functional test.
- test_config = nose.config.Config( env=os.environ, plugins=nose.plugins.manager.DefaultPluginManager() )
- test_config.configure( sys.argv )
- # Run the uninstall method. This method uses the Galaxy web interface to uninstall the previously installed
- # repository and delete it from disk.
- result, _ = run_tests( test_config )
- success = result.wasSuccessful()
- if not success:
- log.debug( 'Repository %s failed to uninstall.' % str( name ) )
-
-def uninstall_tool_dependency( app, tool_dependency ):
- """Attempt to uninstall a tool dependency."""
- sa_session = app.model.context.current
- # Clean out any generated tests. This is necessary for Twill.
- tool_dependency_install_path = tool_dependency.installation_directory( app )
- uninstalled, error_message = tool_dependency_util.remove_tool_dependency( app, tool_dependency )
- if error_message:
- log.debug( 'There was an error attempting to remove directory: %s' % str( tool_dependency_install_path ) )
- log.debug( error_message )
- else:
- log.debug( 'Successfully removed tool dependency installation directory: %s' % str( tool_dependency_install_path ) )
- if not uninstalled or tool_dependency.status != app.model.ToolDependency.installation_status.UNINSTALLED:
- tool_dependency.status = app.model.ToolDependency.installation_status.UNINSTALLED
- sa_session.add( tool_dependency )
- sa_session.flush()
- if os.path.exists( tool_dependency_install_path ):
- log.debug( 'Uninstallation of tool dependency succeeded, but the installation path still exists on the filesystem. It is now being explicitly deleted.')
- suc.remove_dir( tool_dependency_install_path )
-
def main():
if tool_shed_api_key is None:
# If the tool shed URL specified in any dict is not present in the tool_sheds_conf.xml, the installation will fail.
log.debug( 'Cannot proceed without a valid tool shed API key set in the enviroment variable GALAXY_INSTALL_TEST_TOOL_SHED_API_KEY.' )
return 1
+ if galaxy_tool_shed_url is None:
+ log.debug( 'Cannot proceed without a valid Tool Shed base URL set in the environment variable GALAXY_INSTALL_TEST_TOOL_SHED_URL.' )
+ return 1
# ---- Configuration ------------------------------------------------------
galaxy_test_host = os.environ.get( 'GALAXY_INSTALL_TEST_HOST', default_galaxy_test_host )
- # Set the GALAXY_INSTALL_TEST_HOST variable so that Twill will have the Galaxy url to install repositories into.
+ # Set the GALAXY_INSTALL_TEST_HOST variable so that Twill will have the Galaxy url to which to
+ # install repositories.
os.environ[ 'GALAXY_INSTALL_TEST_HOST' ] = galaxy_test_host
- # Set the GALAXY_TEST_HOST environment variable so that the toolbox tests will have the Galaxy url to run tool functional
- # tests on.
+ # Set the GALAXY_TEST_HOST environment variable so that the toolbox tests will have the Galaxy url
+ # on which to to run tool functional tests.
os.environ[ 'GALAXY_TEST_HOST' ] = galaxy_test_host
galaxy_test_port = os.environ.get( 'GALAXY_INSTALL_TEST_PORT', str( default_galaxy_test_port_max ) )
os.environ[ 'GALAXY_TEST_PORT' ] = galaxy_test_port
@@ -1040,17 +764,25 @@
if not os.path.isdir( galaxy_test_tmp_dir ):
os.mkdir( galaxy_test_tmp_dir )
# Set up the configuration files for the Galaxy instance.
- shed_tool_data_table_conf_file = os.environ.get( 'GALAXY_INSTALL_TEST_SHED_TOOL_DATA_TABLE_CONF', os.path.join( galaxy_test_tmp_dir, 'test_shed_tool_data_table_conf.xml' ) )
- galaxy_tool_data_table_conf_file = os.environ.get( 'GALAXY_INSTALL_TEST_TOOL_DATA_TABLE_CONF', tool_data_table_conf )
- galaxy_tool_conf_file = os.environ.get( 'GALAXY_INSTALL_TEST_TOOL_CONF', os.path.join( galaxy_test_tmp_dir, 'test_tool_conf.xml' ) )
- galaxy_job_conf_file = os.environ.get( 'GALAXY_INSTALL_TEST_JOB_CONF', os.path.join( galaxy_test_tmp_dir, 'test_job_conf.xml' ) )
- galaxy_shed_tool_conf_file = os.environ.get( 'GALAXY_INSTALL_TEST_SHED_TOOL_CONF', os.path.join( galaxy_test_tmp_dir, 'test_shed_tool_conf.xml' ) )
- galaxy_migrated_tool_conf_file = os.environ.get( 'GALAXY_INSTALL_TEST_MIGRATED_TOOL_CONF', os.path.join( galaxy_test_tmp_dir, 'test_migrated_tool_conf.xml' ) )
- galaxy_tool_sheds_conf_file = os.environ.get( 'GALAXY_INSTALL_TEST_TOOL_SHEDS_CONF', os.path.join( galaxy_test_tmp_dir, 'test_tool_sheds_conf.xml' ) )
- galaxy_shed_tools_dict = os.environ.get( 'GALAXY_INSTALL_TEST_SHED_TOOL_DICT_FILE', os.path.join( galaxy_test_tmp_dir, 'shed_tool_dict' ) )
+ shed_tool_data_table_conf_file = os.environ.get( 'GALAXY_INSTALL_TEST_SHED_TOOL_DATA_TABLE_CONF',
+ os.path.join( galaxy_test_tmp_dir, 'test_shed_tool_data_table_conf.xml' ) )
+ galaxy_tool_data_table_conf_file = os.environ.get( 'GALAXY_INSTALL_TEST_TOOL_DATA_TABLE_CONF',
+ tool_data_table_conf )
+ galaxy_tool_conf_file = os.environ.get( 'GALAXY_INSTALL_TEST_TOOL_CONF',
+ os.path.join( galaxy_test_tmp_dir, 'test_tool_conf.xml' ) )
+ galaxy_job_conf_file = os.environ.get( 'GALAXY_INSTALL_TEST_JOB_CONF',
+ os.path.join( galaxy_test_tmp_dir, 'test_job_conf.xml' ) )
+ galaxy_shed_tool_conf_file = os.environ.get( 'GALAXY_INSTALL_TEST_SHED_TOOL_CONF',
+ os.path.join( galaxy_test_tmp_dir, 'test_shed_tool_conf.xml' ) )
+ galaxy_migrated_tool_conf_file = os.environ.get( 'GALAXY_INSTALL_TEST_MIGRATED_TOOL_CONF',
+ os.path.join( galaxy_test_tmp_dir, 'test_migrated_tool_conf.xml' ) )
+ galaxy_tool_sheds_conf_file = os.environ.get( 'GALAXY_INSTALL_TEST_TOOL_SHEDS_CONF',
+ os.path.join( galaxy_test_tmp_dir, 'test_tool_sheds_conf.xml' ) )
+ galaxy_shed_tools_dict = os.environ.get( 'GALAXY_INSTALL_TEST_SHED_TOOL_DICT_FILE',
+ os.path.join( galaxy_test_tmp_dir, 'shed_tool_dict' ) )
file( galaxy_shed_tools_dict, 'w' ).write( to_json_string( {} ) )
- # Set the GALAXY_TOOL_SHED_TEST_FILE environment variable to the path of the shed_tools_dict file, so that test.base.twilltestcase.setUp
- # will find and parse it properly.
+ # Set the GALAXY_TOOL_SHED_TEST_FILE environment variable to the path of the shed_tools_dict file so that
+ # test.base.twilltestcase.setUp will find and parse it properly.
os.environ[ 'GALAXY_TOOL_SHED_TEST_FILE' ] = galaxy_shed_tools_dict
if 'GALAXY_INSTALL_TEST_TOOL_DATA_PATH' in os.environ:
tool_data_path = os.environ.get( 'GALAXY_INSTALL_TEST_TOOL_DATA_PATH' )
@@ -1261,20 +993,267 @@
if os.path.exists( dir ):
try:
shutil.rmtree( dir )
- log.debug( "Cleaned up temporary files in %s", dir )
+ log.debug( "Cleaned up temporary files in %s", str( dir ) )
except:
pass
else:
log.debug( 'GALAXY_INSTALL_TEST_NO_CLEANUP set, not cleaning up.' )
- # Normally, the value of 'success' would determine whether this test suite is marked as passed or failed
- # in the automated buildbot framework. However, due to the procedure used here, we only want to report
- # failure if a repository fails to install correctly. Therefore, we have overriden the value of 'success'
- # here based on what actions the script has executed.
+ # Normally the value of 'success' would determine whether this test suite is marked as passed or failed
+ # in the automated buildbot framework. However, due to the procedure used here we only want to report
+ # failure if a repository fails to install correctly, so we have overriden the value of 'success' here
+ # based on what actions the script has executed.
if success:
return 0
else:
return 1
+def parse_exclude_list( xml_filename ):
+ """Return a list of repositories to exclude from testing."""
+ # This method should return a list with the following structure:
+ # [{ 'reason': The default reason or the reason specified in this section,
+ # 'repositories': [( name, owner, changeset revision if changeset revision else None ),
+ # ( name, owner, changeset revision if changeset revision else None )]}]
+ exclude_list = []
+ exclude_verbose = []
+ xml_tree, error_message = parse_xml( xml_filename )
+ if error_message:
+ log.debug( 'The xml document %s defining the exclude list is invalid, so no repositories will be excluded from testing: %s' % \
+ ( str( xml_filename ), str( error_message ) ) )
+ return exclude_list
+ tool_sheds = xml_tree.findall( 'repositories' )
+ xml_element = []
+ exclude_count = 0
+ for tool_shed in tool_sheds:
+ if galaxy_tool_shed_url != tool_shed.attrib[ 'tool_shed' ]:
+ continue
+ else:
+ xml_element = tool_shed
+ for reason_section in xml_element:
+ reason_text = reason_section.find( 'text' ).text
+ repositories = reason_section.findall( 'repository' )
+ exclude_dict = dict( reason=reason_text, repositories=[] )
+ for repository in repositories:
+ repository_tuple = get_repository_tuple_from_elem( repository )
+ if repository_tuple not in exclude_dict[ 'repositories' ]:
+ exclude_verbose.append( repository_tuple )
+ exclude_count += 1
+ exclude_dict[ 'repositories' ].append( repository_tuple )
+ exclude_list.append( exclude_dict )
+ log.debug( '%s repositories will be excluded from testing...' % str( exclude_count ) )
+ if '-list_repositories' in sys.argv:
+ for name, owner, changeset_revision in exclude_verbose:
+ if changeset_revision:
+ log.debug( 'Repository %s owned by %s, changeset revision %s.' % ( str( name ), str( owner ), str( changeset_revision ) ) )
+ else:
+ log.debug( 'Repository %s owned by %s, all revisions.' % ( str( name ), str( owner ) ) )
+ return exclude_list
+
+def register_test_result( url, test_results_dict, repository_dict, params ):
+ """
+ Update the repository metadata tool_test_results and appropriate flags using the Tool SHed API. This method
+ updates tool_test_results with the relevant data, sets the do_not_test and tools_functionally correct flags
+ to the appropriate values and updates the time_last_tested field to the value of the received time_tested.
+ """
+ if '-info_only' in sys.argv or 'GALAXY_INSTALL_TEST_INFO_ONLY' in os.environ:
+ return {}
+ else:
+ metadata_revision_id = repository_dict.get( 'id', None )
+ if metadata_revision_id is not None:
+ # Set the time_last_tested entry so that the repository_metadata.time_last_tested will be set in the tool shed.
+ time_tested = datetime.utcnow()
+ test_results_dict[ 'time_last_tested' ] = time_ago( time_tested )
+ params[ 'tool_test_results' ] = test_results_dict
+ url = '%s' % ( suc.url_join( galaxy_tool_shed_url,'api', 'repository_revisions', str( metadata_revision_id ) ) )
+ try:
+ return update( tool_shed_api_key, url, params, return_formatted=False )
+ except Exception, e:
+ log.exception( 'Error attempting to register test results: %s' % str( e ) )
+ return {}
+
+def remove_generated_tests( app ):
+ """
+ Delete any configured tool functional tests from the test_toolbox.__dict__, otherwise nose will find them
+ and try to re-run the tests after uninstalling the repository, which will cause false failure reports,
+ since the test data has been deleted from disk by now.
+ """
+ tests_to_delete = []
+ tools_to_delete = []
+ global test_toolbox
+ for key in test_toolbox.__dict__:
+ if key.startswith( 'TestForTool_' ):
+ log.debug( 'Tool test found in test_toolbox, deleting: %s' % str( key ) )
+ # We can't delete this test just yet, we're still iterating over __dict__.
+ tests_to_delete.append( key )
+ tool_id = key.replace( 'TestForTool_', '' )
+ for tool in app.toolbox.tools_by_id:
+ if tool.replace( '_', ' ' ) == tool_id.replace( '_', ' ' ):
+ tools_to_delete.append( tool )
+ for key in tests_to_delete:
+ # Now delete the tests found in the previous loop.
+ del test_toolbox.__dict__[ key ]
+ for tool in tools_to_delete:
+ del app.toolbox.tools_by_id[ tool ]
+
+def remove_install_tests():
+ """
+ Delete any configured repository installation tests from the test_toolbox.__dict__, otherwise nose will find them
+ and try to install the repository again while running tool functional tests.
+ """
+ tests_to_delete = []
+ global test_toolbox
+ # Push all the toolbox tests to module level
+ for key in test_install_repositories.__dict__:
+ if key.startswith( 'TestInstallRepository_' ):
+ log.debug( 'Repository installation process found, deleting: %s' % str( key ) )
+ # We can't delete this test just yet, we're still iterating over __dict__.
+ tests_to_delete.append( key )
+ for key in tests_to_delete:
+ # Now delete the tests found in the previous loop.
+ del test_install_repositories.__dict__[ key ]
+
+def run_tests( test_config ):
+ loader = nose.loader.TestLoader( config=test_config )
+ test_config.plugins.addPlugin( ReportResults() )
+ plug_loader = test_config.plugins.prepareTestLoader( loader )
+ if plug_loader is not None:
+ loader = plug_loader
+ tests = loader.loadTestsFromNames( test_config.testNames )
+ test_runner = nose.core.TextTestRunner( stream=test_config.stream,
+ verbosity=test_config.verbosity,
+ config=test_config )
+ plug_runner = test_config.plugins.prepareTestRunner( test_runner )
+ if plug_runner is not None:
+ test_runner = plug_runner
+ result = test_runner.run( tests )
+ return result, test_config.plugins._plugins
+
+def show_summary_output( repository_dicts ):
+ repositories_by_owner = {}
+ for repository in repository_dicts:
+ if repository[ 'owner' ] not in repositories_by_owner:
+ repositories_by_owner[ repository[ 'owner' ] ] = []
+ repositories_by_owner[ repository[ 'owner' ] ].append( repository )
+ for owner in repositories_by_owner:
+ print "# "
+ for repository in repositories_by_owner[ owner ]:
+ print "# %s owned by %s, changeset revision %s" % ( repository[ 'name' ], repository[ 'owner' ], repository[ 'changeset_revision' ] )
+
+def test_repository_tools( app, repository, repository_dict, tool_test_results_dict, results_dict ):
+ """Test tools contained in the received repository."""
+ name = str( repository.name )
+ owner = str( repository.owner )
+ changeset_revision = str( repository.changeset_revision )
+ # Set the module-level variable 'toolbox', so that test.functional.test_toolbox will generate the appropriate test methods.
+ test_toolbox.toolbox = app.toolbox
+ # Generate the test methods for this installed repository. We need to pass in True here, or it will look
+ # in $GALAXY_HOME/test-data for test data, which may result in missing or invalid test files.
+ test_toolbox.build_tests( testing_shed_tools=True, master_api_key=default_galaxy_master_api_key )
+ # Set up nose to run the generated functional tests.
+ test_config = nose.config.Config( env=os.environ, plugins=nose.plugins.manager.DefaultPluginManager() )
+ test_config.configure( sys.argv )
+ # Run the configured tests.
+ result, test_plugins = run_tests( test_config )
+ success = result.wasSuccessful()
+ # Use the ReportResults nose plugin to get a list of tests that passed.
+ for plugin in test_plugins:
+ if hasattr( plugin, 'getTestStatus' ):
+ test_identifier = '%s/%s' % ( owner, name )
+ passed_tests = plugin.getTestStatus( test_identifier )
+ break
+ tool_test_results_dict[ 'passed_tests' ] = []
+ for test_id in passed_tests:
+ # Normalize the tool ID and version display.
+ tool_id, tool_version = get_tool_info_from_test_id( test_id )
+ test_result = dict( test_id=test_id, tool_id=tool_id, tool_version=tool_version )
+ tool_test_results_dict[ 'passed_tests' ].append( test_result )
+ if success:
+ # This repository's tools passed all functional tests. Update the repository_metadata table in the tool shed's database
+ # to reflect that. Call the register_test_result method, which executes a PUT request to the repository_revisions API
+ # controller with the status of the test. This also sets the do_not_test and tools_functionally correct flags, and
+ # updates the time_last_tested field to today's date.
+ results_dict[ 'repositories_passed' ].append( dict( name=name, owner=owner, changeset_revision=changeset_revision ) )
+ params = dict( tools_functionally_correct=True,
+ do_not_test=False,
+ test_install_error=False )
+ register_test_result( galaxy_tool_shed_url, tool_test_results_dict, repository_dict, params )
+ log.debug( 'Revision %s of repository %s installed and passed functional tests.' % ( str( changeset_revision ), str( name ) ) )
+ else:
+ tool_test_results_dict[ 'failed_tests' ].append( extract_log_data( result, from_tool_test=True ) )
+ results_dict[ 'repositories_failed' ].append( dict( name=name, owner=owner, changeset_revision=changeset_revision ) )
+ set_do_not_test = not is_latest_downloadable_revision( galaxy_tool_shed_url, repository_dict )
+ params = dict( tools_functionally_correct=False,
+ test_install_error=False,
+ do_not_test=str( set_do_not_test ) )
+ register_test_result( galaxy_tool_shed_url, tool_test_results_dict, repository_dict, params )
+ log.debug( 'Revision %s of repository %s installed successfully but did not pass functional tests.' % \
+ ( str( changeset_revision ), str( name ) ) )
+ # Run the uninstall method. This removes tool functional test methods from the test_toolbox module and uninstalls the
+ # repository using Twill.
+ deactivate = asbool( os.environ.get( 'GALAXY_INSTALL_TEST_KEEP_TOOL_DEPENDENCIES', False ) )
+ if deactivate:
+ log.debug( 'Deactivating changeset revision %s of repository %s' % ( str( changeset_revision ), str( name ) ) )
+ # We are deactivating this repository and all of its repository dependencies.
+ deactivate_repository( app, repository_dict )
+ else:
+ log.debug( 'Uninstalling changeset revision %s of repository %s' % ( str( changeset_revision ), str( name ) ) )
+ # We are uninstalling this repository and all of its repository dependencies.
+ uninstall_repository( app, repository_dict )
+
+ # Set the test_toolbox.toolbox module-level variable to the new app.toolbox.
+ test_toolbox.toolbox = app.toolbox
+ return results_dict
+
+def uninstall_repository( app, repository_dict ):
+ """Attempt to uninstall a repository."""
+ sa_session = app.model.context.current
+ # Clean out any generated tests. This is necessary for Twill.
+ remove_generated_tests( app )
+ # The dict contains the only repository the app should have installed at this point.
+ name = str( repository_dict[ 'name' ] )
+ owner = str( repository_dict[ 'owner' ] )
+ changeset_revision = str( repository_dict[ 'changeset_revision' ] )
+ repository = test_db_util.get_installed_repository_by_name_owner_changeset_revision( name, owner, changeset_revision )
+ # We have to do this through Twill, in order to maintain app.toolbox and shed_tool_conf.xml in a state that is valid for future tests.
+ for required_repository in repository.repository_dependencies:
+ repository_dict = dict( name=str( required_repository.name ),
+ owner=str( required_repository.owner ),
+ changeset_revision=str( required_repository.changeset_revision ) )
+ # Generate a test method to uninstall this repository through the embedded Galaxy application's web interface.
+ test_install_repositories.generate_deactivate_or_uninstall_method( repository_dict, deactivate=False )
+ log.debug( 'Changeset revision %s of %s repository %s selected for uninstallation.' % \
+ ( str( required_repository.changeset_revision ), str( required_repository.status ), str( required_repository.name ) ) )
+ repository_dict = dict( name=name, owner=owner, changeset_revision=changeset_revision )
+ test_install_repositories.generate_deactivate_or_uninstall_method( repository_dict, deactivate=False )
+ log.debug( 'Changeset revision %s of %s repository %s selected for uninstallation.' % ( changeset_revision, str( repository.status ), name ) )
+ # Set up nose to run the generated uninstall method as a functional test.
+ test_config = nose.config.Config( env=os.environ, plugins=nose.plugins.manager.DefaultPluginManager() )
+ test_config.configure( sys.argv )
+ # Run the uninstall method. This method uses the Galaxy web interface to uninstall the previously installed
+ # repository and delete it from disk.
+ result, _ = run_tests( test_config )
+ success = result.wasSuccessful()
+ if not success:
+ log.debug( 'Repository %s failed to uninstall.' % str( name ) )
+
+def uninstall_tool_dependency( app, tool_dependency ):
+ """Attempt to uninstall a tool dependency."""
+ sa_session = app.model.context.current
+ # Clean out any generated tests. This is necessary for Twill.
+ tool_dependency_install_path = tool_dependency.installation_directory( app )
+ uninstalled, error_message = tool_dependency_util.remove_tool_dependency( app, tool_dependency )
+ if error_message:
+ log.debug( 'There was an error attempting to remove directory: %s' % str( tool_dependency_install_path ) )
+ log.debug( error_message )
+ else:
+ log.debug( 'Successfully removed tool dependency installation directory: %s' % str( tool_dependency_install_path ) )
+ if not uninstalled or tool_dependency.status != app.model.ToolDependency.installation_status.UNINSTALLED:
+ tool_dependency.status = app.model.ToolDependency.installation_status.UNINSTALLED
+ sa_session.add( tool_dependency )
+ sa_session.flush()
+ if os.path.exists( tool_dependency_install_path ):
+ log.debug( 'Uninstallation of tool dependency succeeded, but the installation path still exists on the filesystem. It is now being explicitly deleted.')
+ suc.remove_dir( tool_dependency_install_path )
+
if __name__ == "__main__":
# The tool_test_results_dict should always have the following structure:
# {
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: Dave Bouvier: Clean up the install_repository method in twilltestcase.py. Fix the update manager test when running all functional tests.
by commits-noreply@bitbucket.org 26 Nov '13
by commits-noreply@bitbucket.org 26 Nov '13
26 Nov '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/4cfffc6fce30/
Changeset: 4cfffc6fce30
User: Dave Bouvier
Date: 2013-11-26 17:01:47
Summary: Clean up the install_repository method in twilltestcase.py. Fix the update manager test when running all functional tests.
Affected #: 3 files
diff -r 359a822b2e5da89973ce042942a9a10dd2b229e1 -r 4cfffc6fce30b9dd89849975c473e188936318ad test/install_and_test_tool_shed_repositories/base/twilltestcase.py
--- a/test/install_and_test_tool_shed_repositories/base/twilltestcase.py
+++ b/test/install_and_test_tool_shed_repositories/base/twilltestcase.py
@@ -27,6 +27,21 @@
self.shed_tools_dict = {}
self.home()
+ def deactivate_or_uninstall_repository( self, installed_repository, deactivate=False ):
+ url = '/admin_toolshed/deactivate_or_uninstall_repository?id=%s' % self.security.encode_id( installed_repository.id )
+ self.visit_url( url )
+ if deactivate:
+ tc.fv ( 1, "remove_from_disk", 'false' )
+ else:
+ tc.fv ( 1, "remove_from_disk", 'true' )
+ tc.submit( 'deactivate_or_uninstall_repository_button' )
+ strings_displayed = [ 'The repository named' ]
+ if deactivate:
+ strings_displayed.append( 'has been deactivated' )
+ else:
+ strings_displayed.append( 'has been uninstalled' )
+ self.check_for_strings( strings_displayed, strings_not_displayed=[] )
+
def initiate_installation_process( self,
install_tool_dependencies=False,
install_repository_dependencies=True,
@@ -80,36 +95,40 @@
self.visit_url( url )
# This section is tricky, due to the way twill handles form submission. The tool dependency checkbox needs to
# be hacked in through tc.browser, putting the form field in kwd doesn't work.
- if 'install_tool_dependencies' in self.last_page():
- form = tc.browser.get_form( 'select_tool_panel_section' )
- checkbox = form.find_control( id="install_tool_dependencies" )
- checkbox.disabled = False
- if install_tool_dependencies:
- checkbox.selected = True
- kwd[ 'install_tool_dependencies' ] = 'True'
- else:
- checkbox.selected = False
- kwd[ 'install_tool_dependencies' ] = 'False'
- if 'install_repository_dependencies' in self.last_page():
- form = tc.browser.get_form( 'select_tool_panel_section' )
- checkbox = form.find_control( id="install_repository_dependencies" )
- checkbox.disabled = False
- if install_repository_dependencies:
- checkbox.selected = True
- kwd[ 'install_repository_dependencies' ] = 'True'
- else:
- checkbox.selected = False
- kwd[ 'install_repository_dependencies' ] = 'False'
- if 'shed_tool_conf' not in kwd:
- kwd[ 'shed_tool_conf' ] = self.shed_tool_conf
- if new_tool_panel_section:
- kwd[ 'new_tool_panel_section' ] = new_tool_panel_section
- self.submit_form( 1, 'select_tool_panel_section_button', **kwd )
+ form = tc.browser.get_form( 'select_tool_panel_section' )
+ if form is None:
+ form = tc.browser.get_form( 'select_shed_tool_panel_config' )
+ assert form is not None, 'Could not find form select_shed_tool_panel_config or select_tool_panel_section.'
+ kwd = self.set_form_value( form, kwd, 'install_tool_dependencies', install_tool_dependencies )
+ kwd = self.set_form_value( form, kwd, 'install_repository_dependencies', install_repository_dependencies )
+ kwd = self.set_form_value( form, kwd, 'shed_tool_conf', self.shed_tool_conf )
+ if new_tool_panel_section is not None:
+ kwd = self.set_form_value( form, kwd, 'new_tool_panel_section', new_tool_panel_section )
+ submit_button_control = form.find_control( type='submit' )
+ assert submit_button_control is not None, 'No submit button found for form %s.' % form.attrs.get( 'id' )
+ self.submit_form( form.attrs.get( 'id' ), str( submit_button_control.name ), **kwd )
self.check_for_strings( post_submit_strings_displayed, strings_not_displayed )
repository_ids = self.initiate_installation_process( new_tool_panel_section=new_tool_panel_section )
log.debug( 'Waiting for the installation of repository IDs: %s' % str( repository_ids ) )
self.wait_for_repository_installation( repository_ids )
+ def set_form_value( self, form, kwd, field_name, field_value ):
+ '''
+ Set the form field field_name to field_value if it exists, and return the provided dict containing that value. If
+ the field does not exist in the provided form, return a dict without that index.
+ '''
+ form_id = form.attrs.get( 'id' )
+ controls = [ control for control in form.controls if str( control.name ) == field_name ]
+ if len( controls ) > 0:
+ log.debug( 'Setting field %s of form %s to %s.' % ( field_name, form_id, str( field_value ) ) )
+ tc.formvalue( form_id, field_name, str( field_value ) )
+ kwd[ field_name ] = str( field_value )
+ else:
+ if field_name in kwd:
+ log.debug( 'No field %s in form %s, discarding from return value.' % ( str( control ), str( form_id ) ) )
+ del( kwd[ field_name ] )
+ return kwd
+
def visit_url( self, url, allowed_codes=[ 200 ] ):
new_url = tc.go( url )
return_code = tc.browser.get_code()
@@ -140,17 +159,3 @@
break
time.sleep( 1 )
- def deactivate_or_uninstall_repository( self, installed_repository, deactivate=False ):
- url = '/admin_toolshed/deactivate_or_uninstall_repository?id=%s' % self.security.encode_id( installed_repository.id )
- self.visit_url( url )
- if deactivate:
- tc.fv ( 1, "remove_from_disk", 'false' )
- else:
- tc.fv ( 1, "remove_from_disk", 'true' )
- tc.submit( 'deactivate_or_uninstall_repository_button' )
- strings_displayed = [ 'The repository named' ]
- if deactivate:
- strings_displayed.append( 'has been deactivated' )
- else:
- strings_displayed.append( 'has been uninstalled' )
- self.check_for_strings( strings_displayed, strings_not_displayed=[] )
diff -r 359a822b2e5da89973ce042942a9a10dd2b229e1 -r 4cfffc6fce30b9dd89849975c473e188936318ad test/tool_shed/base/twilltestcase.py
--- a/test/tool_shed/base/twilltestcase.py
+++ b/test/tool_shed/base/twilltestcase.py
@@ -868,34 +868,41 @@
( changeset_revision, repository_id, self.galaxy_url )
self.visit_url( url )
self.check_for_strings( strings_displayed, strings_not_displayed )
- # This section is tricky, due to the way twill handles form submission. The tool dependency checkbox needs to
+ # This section is tricky, due to the way twill handles form submission. The tool dependency checkbox needs to
# be hacked in through tc.browser, putting the form field in kwd doesn't work.
form = tc.browser.get_form( 'select_tool_panel_section' )
- submit_button = 'select_tool_panel_section_button'
if form is None:
form = tc.browser.get_form( 'select_shed_tool_panel_config' )
- submit_button = 'select_shed_tool_panel_config_button'
- if 'install_tool_dependencies' in self.last_page():
- checkbox = form.find_control( id="install_tool_dependencies" )
- checkbox.disabled = False
- if install_tool_dependencies:
- checkbox.selected = True
- kwd[ 'install_tool_dependencies' ] = 'True'
- else:
- checkbox.selected = False
- kwd[ 'install_tool_dependencies' ] = 'False'
- if 'install_repository_dependencies' in self.last_page():
- kwd[ 'install_repository_dependencies' ] = str( install_repository_dependencies ).lower()
- if 'shed_tool_conf' not in kwd:
- kwd[ 'shed_tool_conf' ] = self.shed_tool_conf
- if new_tool_panel_section:
- kwd[ 'new_tool_panel_section' ] = new_tool_panel_section
- if not includes_tools_for_display_in_tool_panel:
- self.check_for_strings( strings_displayed=[ 'Choose the configuration file' ] )
- self.submit_form( 1, submit_button, **kwd )
+ assert form is not None, 'Could not find form select_shed_tool_panel_config or select_tool_panel_section.'
+ kwd = self.set_form_value( form, kwd, 'install_tool_dependencies', install_tool_dependencies )
+ kwd = self.set_form_value( form, kwd, 'install_repository_dependencies', install_repository_dependencies )
+ kwd = self.set_form_value( form, kwd, 'shed_tool_conf', self.shed_tool_conf )
+ if new_tool_panel_section is not None:
+ kwd = self.set_form_value( form, kwd, 'new_tool_panel_section', new_tool_panel_section )
+ submit_button_control = form.find_control( type='submit' )
+ assert submit_button_control is not None, 'No submit button found for form %s.' % form.attrs.get( 'id' )
+ self.submit_form( form.attrs.get( 'id' ), str( submit_button_control.name ), **kwd )
self.check_for_strings( post_submit_strings_displayed, strings_not_displayed )
repository_ids = self.initiate_installation_process( new_tool_panel_section=new_tool_panel_section )
+ log.debug( 'Waiting for the installation of repository IDs: %s' % str( repository_ids ) )
self.wait_for_repository_installation( repository_ids )
+
+ def set_form_value( self, form, kwd, field_name, field_value ):
+ '''
+ Set the form field field_name to field_value if it exists, and return the provided dict containing that value. If
+ the field does not exist in the provided form, return a dict without that index.
+ '''
+ form_id = form.attrs.get( 'id' )
+ controls = [ control for control in form.controls if str( control.name ) == field_name ]
+ if len( controls ) > 0:
+ log.debug( 'Setting field %s of form %s to %s.' % ( field_name, form_id, str( field_value ) ) )
+ tc.formvalue( form_id, field_name, str( field_value ) )
+ kwd[ field_name ] = str( field_value )
+ else:
+ if field_name in kwd:
+ log.debug( 'No field %s in form %s, discarding from return value.' % ( str( control ), str( form_id ) ) )
+ del( kwd[ field_name ] )
+ return kwd
def load_citable_url( self,
username,
diff -r 359a822b2e5da89973ce042942a9a10dd2b229e1 -r 4cfffc6fce30b9dd89849975c473e188936318ad test/tool_shed/functional/test_1410_update_manager.py
--- a/test/tool_shed/functional/test_1410_update_manager.py
+++ b/test/tool_shed/functional/test_1410_update_manager.py
@@ -126,9 +126,6 @@
ok_icon = '/static/june_2007_style/blue/ok_small.png'
ok_title = 'This is the latest installable revision of this repository'
updates_icon = '/static/images/icon_warning_sml.gif'
- repository_id = self.security.encode_id( repository.id )
- html = '<label id="%s" for="%s"><img src="%s" class="icon-button" title="%s"/><img src="%s' % \
- ( repository_id, repository_id, ok_icon, ok_title, updates_icon )
- strings_displayed = [ html ]
+ strings_displayed = [ '<img src="%s" class="icon-button" title="%s"/><img src="%s' % ( ok_icon, ok_title, updates_icon ) ]
self.display_galaxy_browse_repositories_page( strings_displayed=strings_displayed )
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
4 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/934fe4d500ec/
Changeset: 934fe4d500ec
Branch: page-api
User: Kyle Ellrott
Date: 2013-11-21 22:50:59
Summary: Adding page search to the search API. Also adding plural id encoding (a list named '*_ids' will get id encoded)
Affected #: 3 files
diff -r 253f888144aaa4ae4eadaf15de493b3144fc5cd3 -r 934fe4d500ec7fba8d41c634eb70dc0381dee41c lib/galaxy/model/__init__.py
--- a/lib/galaxy/model/__init__.py
+++ b/lib/galaxy/model/__init__.py
@@ -3140,7 +3140,8 @@
self.session = session
self.openid = openid
-class Page( object ):
+class Page( object, Dictifiable ):
+ dict_element_visible_keys = [ 'id', 'title', 'latest_revision_id', 'slug' ]
def __init__( self ):
self.id = None
self.user = None
@@ -3151,6 +3152,14 @@
self.importable = None
self.published = None
+ def to_dict( self, view='element' ):
+ rval = super( Page, self ).to_dict( view=view )
+ rev = []
+ for a in self.revisions:
+ rev.append(a.id)
+ rval['revision_ids'] = rev
+ return rval
+
class PageRevision( object ):
def __init__( self ):
self.user = None
diff -r 253f888144aaa4ae4eadaf15de493b3144fc5cd3 -r 934fe4d500ec7fba8d41c634eb70dc0381dee41c lib/galaxy/model/search.py
--- a/lib/galaxy/model/search.py
+++ b/lib/galaxy/model/search.py
@@ -35,7 +35,8 @@
History, Library, LibraryFolder, LibraryDataset,StoredWorkflowTagAssociation,
StoredWorkflow, HistoryTagAssociation,HistoryDatasetAssociationTagAssociation,
ExtendedMetadata, ExtendedMetadataIndex, HistoryAnnotationAssociation, Job, JobParameter,
-JobToInputLibraryDatasetAssociation, JobToInputDatasetAssociation, JobToOutputDatasetAssociation, ToolVersion )
+JobToInputLibraryDatasetAssociation, JobToInputDatasetAssociation, JobToOutputDatasetAssociation, ToolVersion,
+Page )
from galaxy.util.json import to_json_string
from sqlalchemy import and_
@@ -469,6 +470,20 @@
+##################
+#Page Searching
+##################
+
+class PageView(ViewQueryBaseClass):
+ DOMAIN = "page"
+ FIELDS = {
+ 'id' : ViewField('id', sqlalchemy_field=Page.id, id_decode=True),
+ 'title' : ViewField('title', sqlalchemy_field=Page.title),
+ }
+
+ def search(self, trans):
+ self.query = trans.sa_session.query( Page )
+
"""
The view mapping takes a user's name for a table and maps it to a View class that will
handle queries
@@ -486,6 +501,7 @@
'workflow' : WorkflowView,
'tool' : ToolView,
'job' : JobView,
+ 'page' : PageView
}
"""
diff -r 253f888144aaa4ae4eadaf15de493b3144fc5cd3 -r 934fe4d500ec7fba8d41c634eb70dc0381dee41c lib/galaxy/web/base/controller.py
--- a/lib/galaxy/web/base/controller.py
+++ b/lib/galaxy/web/base/controller.py
@@ -166,6 +166,14 @@
rval[k] = trans.security.encode_id( v )
except:
pass # probably already encoded
+ if (k.endswith("_ids") and type(v) == list):
+ try:
+ o = []
+ for i in v:
+ o.append(trans.security.encode_id( i ))
+ rval[k] = o
+ except:
+ pass
else:
if recursive and type(v) == dict:
rval[k] = self.encode_all_ids(trans, v, recursive)
https://bitbucket.org/galaxy/galaxy-central/commits/ebe7a63e01e9/
Changeset: ebe7a63e01e9
Branch: page-api
User: Kyle Ellrott
Date: 2013-11-21 23:07:52
Summary: Adding page revisions to search api
Affected #: 2 files
diff -r 934fe4d500ec7fba8d41c634eb70dc0381dee41c -r ebe7a63e01e91bc75e447c5c159a2f142b7b894c lib/galaxy/model/__init__.py
--- a/lib/galaxy/model/__init__.py
+++ b/lib/galaxy/model/__init__.py
@@ -3160,12 +3160,19 @@
rval['revision_ids'] = rev
return rval
-class PageRevision( object ):
+class PageRevision( object, Dictifiable ):
+ dict_element_visible_keys = [ 'id', 'page_id', 'title', 'content' ]
def __init__( self ):
self.user = None
self.title = None
self.content = None
+ def to_dict( self, view='element' ):
+ rval = super( PageRevision, self ).to_dict( view=view )
+ rval['create_time'] = str(self.create_time)
+ rval['update_time'] = str(self.update_time)
+ return rval
+
class PageUserShareAssociation( object ):
def __init__( self ):
self.page = None
diff -r 934fe4d500ec7fba8d41c634eb70dc0381dee41c -r ebe7a63e01e91bc75e447c5c159a2f142b7b894c lib/galaxy/model/search.py
--- a/lib/galaxy/model/search.py
+++ b/lib/galaxy/model/search.py
@@ -36,7 +36,7 @@
StoredWorkflow, HistoryTagAssociation,HistoryDatasetAssociationTagAssociation,
ExtendedMetadata, ExtendedMetadataIndex, HistoryAnnotationAssociation, Job, JobParameter,
JobToInputLibraryDatasetAssociation, JobToInputDatasetAssociation, JobToOutputDatasetAssociation, ToolVersion,
-Page )
+Page, PageRevision )
from galaxy.util.json import to_json_string
from sqlalchemy import and_
@@ -484,6 +484,27 @@
def search(self, trans):
self.query = trans.sa_session.query( Page )
+
+
+
+##################
+#Page Revision Searching
+##################
+
+
+class PageRevisionView(ViewQueryBaseClass):
+ DOMAIN = "page_revision"
+ FIELDS = {
+ 'id' : ViewField('id', sqlalchemy_field=PageRevision.id, id_decode=True),
+ 'title' : ViewField('title', sqlalchemy_field=PageRevision.title),
+ 'page_id' : ViewField('page_id', sqlalchemy_field=PageRevision.page_id, id_decode=True),
+ }
+
+ def search(self, trans):
+ self.query = trans.sa_session.query( PageRevision )
+
+
+
"""
The view mapping takes a user's name for a table and maps it to a View class that will
handle queries
@@ -501,7 +522,8 @@
'workflow' : WorkflowView,
'tool' : ToolView,
'job' : JobView,
- 'page' : PageView
+ 'page' : PageView,
+ 'page_revision' : PageRevisionView,
}
"""
https://bitbucket.org/galaxy/galaxy-central/commits/d50335029705/
Changeset: d50335029705
Branch: page-api
User: Kyle Ellrott
Date: 2013-11-21 23:29:42
Summary: Adding security checks to pages found via search api. Also fixing some bugs related to search security checks.
Affected #: 1 file
diff -r ebe7a63e01e91bc75e447c5c159a2f142b7b894c -r d50335029705d4e587a7a6428b9da6e4fc4890cf lib/galaxy/webapps/galaxy/api/search.py
--- a/lib/galaxy/webapps/galaxy/api/search.py
+++ b/lib/galaxy/webapps/galaxy/api/search.py
@@ -5,7 +5,7 @@
from galaxy import web
from galaxy.web.base.controller import SharableItemSecurityMixin, BaseAPIController
from galaxy.model.search import GalaxySearchEngine
-
+from galaxy.exceptions import ItemAccessibilityException
log = logging.getLogger( __name__ )
@@ -37,15 +37,28 @@
if trans.user_is_admin():
append = True
if not append:
- if type( item ) in ( trans.app.model.LibraryFolder, trans.app.model.LibraryDatasetDatasetAssociation, trans.app.model.LibraryDataset ):
+ if type( item ) in [ trans.app.model.LibraryFolder, trans.app.model.LibraryDatasetDatasetAssociation, trans.app.model.LibraryDataset ]:
if (trans.app.security_agent.can_access_library_item( trans.get_current_user_roles(), item, trans.user ) ):
append = True
- elif type( item ) in trans.app.model.Job:
+ elif type( item ) in [ trans.app.model.Job ]:
if item.used_id == trans.user or trans.user_is_admin():
append = True
+ elif type( item ) in [ trans.app.model.Page ]:
+ try:
+ if self.security_check( trans, item, False, True):
+ append = True
+ except ItemAccessibilityException:
+ append = False
+ elif type ( item ) in [ trans.app.model.PageRevision ]:
+ try:
+ if self.security_check( trans, item.page, False, True):
+ append = True
+ except ItemAccessibilityException:
+ append = False
elif hasattr(item, 'dataset'):
if trans.app.security_agent.can_access_dataset( current_user_roles, item.dataset ):
append = True
+
if append:
row = query.item_to_api_value(item)
out.append( self.encode_all_ids( trans, row, True) )
https://bitbucket.org/galaxy/galaxy-central/commits/359a822b2e5d/
Changeset: 359a822b2e5d
User: jmchilton
Date: 2013-11-26 15:04:27
Summary: Merged in kellrott/galaxy-central/page-api (pull request #266)
Adding Pages and PageRevisions to the search API
Affected #: 4 files
diff -r c0384bad246d60a0ca737685cc67eb17331b36fa -r 359a822b2e5da89973ce042942a9a10dd2b229e1 lib/galaxy/model/__init__.py
--- a/lib/galaxy/model/__init__.py
+++ b/lib/galaxy/model/__init__.py
@@ -3140,7 +3140,8 @@
self.session = session
self.openid = openid
-class Page( object ):
+class Page( object, Dictifiable ):
+ dict_element_visible_keys = [ 'id', 'title', 'latest_revision_id', 'slug' ]
def __init__( self ):
self.id = None
self.user = None
@@ -3151,12 +3152,27 @@
self.importable = None
self.published = None
-class PageRevision( object ):
+ def to_dict( self, view='element' ):
+ rval = super( Page, self ).to_dict( view=view )
+ rev = []
+ for a in self.revisions:
+ rev.append(a.id)
+ rval['revision_ids'] = rev
+ return rval
+
+class PageRevision( object, Dictifiable ):
+ dict_element_visible_keys = [ 'id', 'page_id', 'title', 'content' ]
def __init__( self ):
self.user = None
self.title = None
self.content = None
+ def to_dict( self, view='element' ):
+ rval = super( PageRevision, self ).to_dict( view=view )
+ rval['create_time'] = str(self.create_time)
+ rval['update_time'] = str(self.update_time)
+ return rval
+
class PageUserShareAssociation( object ):
def __init__( self ):
self.page = None
diff -r c0384bad246d60a0ca737685cc67eb17331b36fa -r 359a822b2e5da89973ce042942a9a10dd2b229e1 lib/galaxy/model/search.py
--- a/lib/galaxy/model/search.py
+++ b/lib/galaxy/model/search.py
@@ -35,7 +35,8 @@
History, Library, LibraryFolder, LibraryDataset,StoredWorkflowTagAssociation,
StoredWorkflow, HistoryTagAssociation,HistoryDatasetAssociationTagAssociation,
ExtendedMetadata, ExtendedMetadataIndex, HistoryAnnotationAssociation, Job, JobParameter,
-JobToInputLibraryDatasetAssociation, JobToInputDatasetAssociation, JobToOutputDatasetAssociation, ToolVersion )
+JobToInputLibraryDatasetAssociation, JobToInputDatasetAssociation, JobToOutputDatasetAssociation, ToolVersion,
+Page, PageRevision )
from galaxy.util.json import to_json_string
from sqlalchemy import and_
@@ -469,6 +470,41 @@
+##################
+#Page Searching
+##################
+
+class PageView(ViewQueryBaseClass):
+ DOMAIN = "page"
+ FIELDS = {
+ 'id' : ViewField('id', sqlalchemy_field=Page.id, id_decode=True),
+ 'title' : ViewField('title', sqlalchemy_field=Page.title),
+ }
+
+ def search(self, trans):
+ self.query = trans.sa_session.query( Page )
+
+
+
+
+##################
+#Page Revision Searching
+##################
+
+
+class PageRevisionView(ViewQueryBaseClass):
+ DOMAIN = "page_revision"
+ FIELDS = {
+ 'id' : ViewField('id', sqlalchemy_field=PageRevision.id, id_decode=True),
+ 'title' : ViewField('title', sqlalchemy_field=PageRevision.title),
+ 'page_id' : ViewField('page_id', sqlalchemy_field=PageRevision.page_id, id_decode=True),
+ }
+
+ def search(self, trans):
+ self.query = trans.sa_session.query( PageRevision )
+
+
+
"""
The view mapping takes a user's name for a table and maps it to a View class that will
handle queries
@@ -486,6 +522,8 @@
'workflow' : WorkflowView,
'tool' : ToolView,
'job' : JobView,
+ 'page' : PageView,
+ 'page_revision' : PageRevisionView,
}
"""
diff -r c0384bad246d60a0ca737685cc67eb17331b36fa -r 359a822b2e5da89973ce042942a9a10dd2b229e1 lib/galaxy/web/base/controller.py
--- a/lib/galaxy/web/base/controller.py
+++ b/lib/galaxy/web/base/controller.py
@@ -166,6 +166,14 @@
rval[k] = trans.security.encode_id( v )
except:
pass # probably already encoded
+ if (k.endswith("_ids") and type(v) == list):
+ try:
+ o = []
+ for i in v:
+ o.append(trans.security.encode_id( i ))
+ rval[k] = o
+ except:
+ pass
else:
if recursive and type(v) == dict:
rval[k] = self.encode_all_ids(trans, v, recursive)
diff -r c0384bad246d60a0ca737685cc67eb17331b36fa -r 359a822b2e5da89973ce042942a9a10dd2b229e1 lib/galaxy/webapps/galaxy/api/search.py
--- a/lib/galaxy/webapps/galaxy/api/search.py
+++ b/lib/galaxy/webapps/galaxy/api/search.py
@@ -5,7 +5,7 @@
from galaxy import web
from galaxy.web.base.controller import SharableItemSecurityMixin, BaseAPIController
from galaxy.model.search import GalaxySearchEngine
-
+from galaxy.exceptions import ItemAccessibilityException
log = logging.getLogger( __name__ )
@@ -37,15 +37,28 @@
if trans.user_is_admin():
append = True
if not append:
- if type( item ) in ( trans.app.model.LibraryFolder, trans.app.model.LibraryDatasetDatasetAssociation, trans.app.model.LibraryDataset ):
+ if type( item ) in [ trans.app.model.LibraryFolder, trans.app.model.LibraryDatasetDatasetAssociation, trans.app.model.LibraryDataset ]:
if (trans.app.security_agent.can_access_library_item( trans.get_current_user_roles(), item, trans.user ) ):
append = True
- elif type( item ) in trans.app.model.Job:
+ elif type( item ) in [ trans.app.model.Job ]:
if item.used_id == trans.user or trans.user_is_admin():
append = True
+ elif type( item ) in [ trans.app.model.Page ]:
+ try:
+ if self.security_check( trans, item, False, True):
+ append = True
+ except ItemAccessibilityException:
+ append = False
+ elif type ( item ) in [ trans.app.model.PageRevision ]:
+ try:
+ if self.security_check( trans, item.page, False, True):
+ append = True
+ except ItemAccessibilityException:
+ append = False
elif hasattr(item, 'dataset'):
if trans.app.security_agent.can_access_dataset( current_user_roles, item.dataset ):
append = True
+
if append:
row = query.item_to_api_value(item)
out.append( self.encode_all_ids( trans, row, True) )
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: greg: Fix for the previous fix for rendering the "Skip tool test" section on the manage_repository page in the tool shed.
by commits-noreply@bitbucket.org 25 Nov '13
by commits-noreply@bitbucket.org 25 Nov '13
25 Nov '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/c0384bad246d/
Changeset: c0384bad246d
User: greg
Date: 2013-11-26 00:45:37
Summary: Fix for the previous fix for rendering the "Skip tool test" section on the manage_repository page in the tool shed.
Affected #: 1 file
diff -r 1a8070a3b08a65ae386b849548ecf921d916cf7a -r c0384bad246d60a0ca737685cc67eb17331b36fa templates/webapps/tool_shed/repository/manage_repository.mako
--- a/templates/webapps/tool_shed/repository/manage_repository.mako
+++ b/templates/webapps/tool_shed/repository/manage_repository.mako
@@ -72,6 +72,17 @@
tip_str = ''
sharable_link_label = 'Sharable link to this repository revision:'
sharable_link_changeset_revision = changeset_revision
+
+ if repository_metadata is None:
+ can_render_skip_tool_test_section = False
+ else:
+ if repository_metadata.changeset_revision is None:
+ can_render_skip_tool_test_section = False
+ else:
+ if includes_tools or repository.type == TOOL_DEPENDENCY_DEFINITION:
+ can_render_skip_tool_test_section = True
+ else:
+ can_render_skip_tool_test_section = False
%><%!
@@ -200,7 +211,7 @@
</div></div>
${render_repository_items( metadata, containers_dict, can_set_metadata=True, render_repository_actions_for='tool_shed' )}
-%if includes_tools or repository.type == TOOL_DEPENDENCY_DEFINITION:
+%if can_render_skip_tool_test_section:
<p/><div class="toolForm">
%if repository.type == TOOL_DEPENDENCY_DEFINITION:
@@ -209,7 +220,7 @@
<div class="toolFormTitle">Automated tool tests</div>
%endif
<div class="toolFormBody">
- <form name="skip_tool_tests" id="skip_tool_tests" action="${h.url_for( controller='repository', action='manage_repository', id=trans.security.encode_id( repository.id ), changeset_revision=changeset_revision )}" method="post" >
+ <form name="skip_tool_tests" id="skip_tool_tests" action="${h.url_for( controller='repository', action='manage_repository', id=trans.security.encode_id( repository.id ), changeset_revision=str( repository_metadata.changeset_revision ) )}" method="post" ><div class="form-row">
%if repository.type == TOOL_DEPENDENCY_DEFINITION:
<label>Skip automated testing of this tool dependency recipe</label>
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: afgane: Revert API tool installation fix because it break the GUI installs; API will still need a fix
by commits-noreply@bitbucket.org 25 Nov '13
by commits-noreply@bitbucket.org 25 Nov '13
25 Nov '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/1a8070a3b08a/
Changeset: 1a8070a3b08a
User: afgane
Date: 2013-11-26 00:06:21
Summary: Revert API tool installation fix because it break the GUI installs; API will still need a fix
Affected #: 1 file
diff -r 011df6fa309e9b4a052d5342218e888deabd063f -r 1a8070a3b08a65ae386b849548ecf921d916cf7a lib/tool_shed/util/tool_util.py
--- a/lib/tool_shed/util/tool_util.py
+++ b/lib/tool_shed/util/tool_util.py
@@ -673,7 +673,7 @@
tool_panel_section_id=section_id,
new_tool_panel_section=new_tool_panel_section )
elif tool_panel_section:
- tool_panel_section_key = 'section_%s' % str( tool_panel_section.id )
+ tool_panel_section_key = 'section_%s' % str( tool_panel_section )
tool_section = trans.app.toolbox.tool_panel[ tool_panel_section_key ]
else:
return None, None
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: greg: Fix for rendering Skip tool tests" form on the manage_repository page in the tool shed.
by commits-noreply@bitbucket.org 25 Nov '13
by commits-noreply@bitbucket.org 25 Nov '13
25 Nov '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/011df6fa309e/
Changeset: 011df6fa309e
User: greg
Date: 2013-11-25 22:53:40
Summary: Fix for rendering Skip tool tests" form on the manage_repository page in the tool shed.
Affected #: 1 file
diff -r 11eb2e028791aca01c206fa5e898e1feb28f4651 -r 011df6fa309e9b4a052d5342218e888deabd063f templates/webapps/tool_shed/repository/manage_repository.mako
--- a/templates/webapps/tool_shed/repository/manage_repository.mako
+++ b/templates/webapps/tool_shed/repository/manage_repository.mako
@@ -209,7 +209,7 @@
<div class="toolFormTitle">Automated tool tests</div>
%endif
<div class="toolFormBody">
- <form name="skip_tool_tests" id="skip_tool_tests" action="${h.url_for( controller='repository', action='manage_repository', id=trans.security.encode_id( repository.id ), changeset_revision=repository_metadata.changeset_revision )}" method="post" >
+ <form name="skip_tool_tests" id="skip_tool_tests" action="${h.url_for( controller='repository', action='manage_repository', id=trans.security.encode_id( repository.id ), changeset_revision=changeset_revision )}" method="post" ><div class="form-row">
%if repository.type == TOOL_DEPENDENCY_DEFINITION:
<label>Skip automated testing of this tool dependency recipe</label>
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: greg: Minor fixes for the prep script for installing and testing tool shed repositories of type tool_dependency_definition.
by commits-noreply@bitbucket.org 25 Nov '13
by commits-noreply@bitbucket.org 25 Nov '13
25 Nov '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/11eb2e028791/
Changeset: 11eb2e028791
User: greg
Date: 2013-11-25 22:43:01
Summary: Minor fixes for the prep script for installing and testing tool shed repositories of type tool_dependency_definition.
Affected #: 1 file
diff -r ec2a03eea18ee82c71618d291394da81414cfb45 -r 11eb2e028791aca01c206fa5e898e1feb28f4651 lib/tool_shed/scripts/check_tool_dependency_definition_repositories.py
--- a/lib/tool_shed/scripts/check_tool_dependency_definition_repositories.py
+++ b/lib/tool_shed/scripts/check_tool_dependency_definition_repositories.py
@@ -28,7 +28,9 @@
from base.util import get_database_version
from base.util import get_repository_current_revision
from base.util import get_test_environment
-from galaxy.model.orm import and_, not_, select
+from galaxy.model.orm import and_
+from galaxy.model.orm import not_
+from galaxy.model.orm import select
from galaxy.web import url_for
from tool_shed.repository_types.util import TOOL_DEPENDENCY_DEFINITION
@@ -138,21 +140,6 @@
app.model.RepositoryMetadata.table.c.repository_id.in_( tool_dependency_defintion_repository_ids ),
not_( app.model.RepositoryMetadata.table.c.id.in_( skip_metadata_ids ) ) ) ):
records_checked += 1
- # Create the repository_status dictionary, using the dictionary from the previous test run if available.
- if repository_metadata.tool_test_results:
- repository_status = repository_metadata.tool_test_results
- else:
- repository_status = {}
- # Initialize the repository_status dictionary with the information about the current test environment.
- last_test_environment = repository_status.get( 'test_environment', None )
- if last_test_environment is None:
- test_environment = get_test_environment()
- else:
- test_environment = get_test_environment( last_test_environment )
- test_environment[ 'tool_shed_database_version' ] = get_database_version( app )
- test_environment[ 'tool_shed_mercurial_version' ] = __version__.version
- test_environment[ 'tool_shed_revision' ] = get_repository_current_revision( os.getcwd() )
- repository_status[ 'test_environment' ] = test_environment
# Check the next repository revision.
changeset_revision = str( repository_metadata.changeset_revision )
name = repository.name
@@ -174,7 +161,18 @@
print 'Revision %s of %s owned by %s has invalid metadata.' % ( changeset_revision, name, owner )
invalid_metadata += 1
if not info_only:
- repository_metadata.tool_test_results = repository_status
+ # Create the tool_test_results_dict dictionary, using the dictionary from the previous test run if available.
+ if repository_metadata.tool_test_results:
+ tool_test_results_dict = repository_metadata.tool_test_results
+ else:
+ tool_test_results_dict = {}
+ # Initialize the tool_test_results_dict dictionary with the information about the current test environment.
+ test_environment_dict = tool_test_results_dict.get( 'test_environment', {} )
+ test_environment_dict[ 'tool_shed_database_version' ] = get_database_version( app )
+ test_environment_dict[ 'tool_shed_mercurial_version' ] = __version__.version
+ test_environment_dict[ 'tool_shed_revision' ] = get_repository_current_revision( os.getcwd() )
+ tool_test_results_dict[ 'test_environment' ] = test_environment_dict
+ repository_metadata.tool_test_results = tool_test_results_dict
app.sa_session.add( repository_metadata )
app.sa_session.flush()
stop = time.time()
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
2 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/f8fc2bc86635/
Changeset: f8fc2bc86635
User: Dave Bouvier
Date: 2013-11-25 22:23:51
Summary: Add API method to list datatype sniffers. Add functional tests for repositories defining datatype sniffers.
Affected #: 1 file
diff -r d0a3879c0708983fccb24b809bfe29d96a8dbb59 -r f8fc2bc8663593075a820157606cca11b905e0e9 test/tool_shed/test_data/proteomics_datatypes/proteomics_datatypes.tar
Binary file test/tool_shed/test_data/proteomics_datatypes/proteomics_datatypes.tar has changed
https://bitbucket.org/galaxy/galaxy-central/commits/ec2a03eea18e/
Changeset: ec2a03eea18e
User: Dave Bouvier
Date: 2013-11-25 22:29:41
Summary: Add API method to list datatype sniffers. Add functional tests for repositories defining datatype sniffers.
Affected #: 4 files
diff -r f8fc2bc8663593075a820157606cca11b905e0e9 -r ec2a03eea18ee82c71618d291394da81414cfb45 lib/galaxy/webapps/galaxy/api/datatypes.py
--- a/lib/galaxy/webapps/galaxy/api/datatypes.py
+++ b/lib/galaxy/webapps/galaxy/api/datatypes.py
@@ -4,20 +4,45 @@
from galaxy import web
from galaxy.web.base.controller import BaseAPIController
+from galaxy.util import asbool
import logging
log = logging.getLogger( __name__ )
+
class DatatypesController( BaseAPIController ):
+
@web.expose_api_anonymous
def index( self, trans, **kwd ):
"""
GET /api/datatypes
- Return an object containing datatypes.
+ Return an object containing upload datatypes.
"""
+ upload_only = asbool( kwd.get( 'upload_only', True ) )
try:
- return trans.app.datatypes_registry.upload_file_formats
+ if upload_only:
+ return trans.app.datatypes_registry.upload_file_formats
+ else:
+ return [ ext for ext in trans.app.datatypes_registry.datatypes_by_extension ]
except Exception, exception:
log.error( 'could not get datatypes: %s', str( exception ), exc_info=True )
trans.response.status = 500
return { 'error': str( exception ) }
+
+ @web.expose_api_anonymous
+ def sniffers( self, trans, **kwd ):
+ '''
+ GET /api/datatypes/sniffers
+ Return a list of sniffers.
+ '''
+ try:
+ rval = []
+ for sniffer_elem in trans.app.datatypes_registry.sniffer_elems:
+ datatype = sniffer_elem.get( 'type' )
+ if datatype is not None:
+ rval.append( datatype )
+ return rval
+ except Exception, exception:
+ log.error( 'could not get datatypes: %s', str( exception ), exc_info=True )
+ trans.response.status = 500
+ return { 'error': str( exception ) }
diff -r f8fc2bc8663593075a820157606cca11b905e0e9 -r ec2a03eea18ee82c71618d291394da81414cfb45 lib/galaxy/webapps/galaxy/buildapp.py
--- a/lib/galaxy/webapps/galaxy/buildapp.py
+++ b/lib/galaxy/webapps/galaxy/buildapp.py
@@ -163,7 +163,11 @@
webapp.mapper.resource( 'workflow', 'workflows', path_prefix='/api' )
webapp.mapper.resource_with_deleted( 'history', 'histories', path_prefix='/api' )
webapp.mapper.resource( 'configuration', 'configuration', path_prefix='/api' )
- webapp.mapper.resource( 'datatype', 'datatypes', path_prefix='/api' )
+ webapp.mapper.resource( 'datatype',
+ 'datatypes',
+ path_prefix='/api',
+ collection={ 'sniffers': 'GET' },
+ parent_resources=dict( member_name='datatype', collection_name='datatypes' ) )
#webapp.mapper.connect( 'run_workflow', '/api/workflow/{workflow_id}/library/{library_id}', controller='workflows', action='run', workflow_id=None, library_id=None, conditions=dict(method=["GET"]) )
webapp.mapper.resource( 'search', 'search', path_prefix='/api' )
diff -r f8fc2bc8663593075a820157606cca11b905e0e9 -r ec2a03eea18ee82c71618d291394da81414cfb45 test/tool_shed/base/twilltestcase.py
--- a/test/tool_shed/base/twilltestcase.py
+++ b/test/tool_shed/base/twilltestcase.py
@@ -618,13 +618,11 @@
return temp_path
def get_datatypes_count( self ):
- url = '/admin/view_datatypes_registry'
+ url = '/api/datatypes?upload_only=false'
self.visit_galaxy_url( url )
html = self.last_page()
- datatypes_count = re.search( 'registry contains (\d+) data types', html )
- if datatypes_count:
- return datatypes_count.group( 1 )
- return None
+ datatypes = from_json_string( html )
+ return len( datatypes )
def get_env_sh_path( self, tool_dependency_name, tool_dependency_version, repository ):
'''Return the absolute path to an installed repository's env.sh file.'''
@@ -735,6 +733,13 @@
repo = self.get_hg_repo( self.get_repo_path( repository ) )
return str( repo.changectx( repo.changelog.tip() ) )
+ def get_sniffers_count( self ):
+ url = '/api/datatypes/sniffers'
+ self.visit_galaxy_url( url )
+ html = self.last_page()
+ sniffers = from_json_string( html )
+ return len( sniffers )
+
def get_tools_from_repository_metadata( self, repository, include_invalid=False ):
'''Get a list of valid and (optionally) invalid tool dicts from the repository metadata.'''
valid_tools = []
diff -r f8fc2bc8663593075a820157606cca11b905e0e9 -r ec2a03eea18ee82c71618d291394da81414cfb45 test/tool_shed/functional/test_1450_installing_datatypes_sniffers.py
--- /dev/null
+++ b/test/tool_shed/functional/test_1450_installing_datatypes_sniffers.py
@@ -0,0 +1,191 @@
+from tool_shed.base.twilltestcase import ShedTwillTestCase, common, os
+import tool_shed.base.test_db_util as test_db_util
+
+repository_name = 'proteomics_datatypes_1450'
+repository_description = "Proteomics datatypes"
+repository_long_description = "Datatypes used in proteomics"
+
+category_name = 'Test 1450 Datatype Sniffers'
+category_description = 'Test 1450 - Installing Datatype Sniffers'
+
+
+'''
+1. Get a count of datatypes and sniffers.
+2. Install proteomics_datatypes_1450.
+3. Verify the count of datatypes and sniffers is the previous count + the datatypes contained within proteomics_datatypes_1450.
+4. Deactivate proteomics_datatypes_1450, verify the count of datatypes and sniffers is equal to the count determined in step 1.
+5. Reactivate proteomics_datatypes_1450, verify that the count of datatypes and sniffers has been increased by the contents of the repository.
+6. Uninstall proteomics_datatypes_1450, verify the count of datatypes and sniffers is equal to the count determined in step 1.
+7. Reinstall proteomics_datatypes_1450, verify that the count of datatypes and sniffers has been increased by the contents of the repository.
+'''
+
+base_datatypes_count = 0
+repository_datatypes_count = 0
+base_sniffers_count = 0
+
+
+class TestInstallDatatypesSniffers( ShedTwillTestCase ):
+ '''Test installing a repository that defines datatypes and datatype sniffers.'''
+
+ def test_0000_initiate_users( self ):
+ """Create necessary user accounts."""
+ global base_datatypes_count
+ self.logout()
+ self.login( email=common.test_user_1_email, username=common.test_user_1_name )
+ test_user_1 = test_db_util.get_user( common.test_user_1_email )
+ assert test_user_1 is not None, 'Problem retrieving user with email %s from the database' % test_user_1_email
+ test_user_1_private_role = test_db_util.get_private_role( test_user_1 )
+ self.logout()
+ self.login( email=common.admin_email, username=common.admin_username )
+ admin_user = test_db_util.get_user( common.admin_email )
+ assert admin_user is not None, 'Problem retrieving user with email %s from the database' % common.admin_email
+ admin_user_private_role = test_db_util.get_private_role( admin_user )
+ self.galaxy_logout()
+ self.galaxy_login( email=common.admin_email, username=common.admin_username )
+ galaxy_admin_user = test_db_util.get_galaxy_user( common.admin_email )
+ assert galaxy_admin_user is not None, 'Problem retrieving user with email %s from the database' % common.admin_email
+ galaxy_admin_user_private_role = test_db_util.get_galaxy_private_role( galaxy_admin_user )
+ base_datatypes_count = self.get_datatypes_count()
+ base_sniffers_count = self.get_sniffers_count()
+
+ def test_0005_ensure_repositories_and_categories_exist( self ):
+ '''Create the 1450 category and proteomics_datatypes_1450 repository.'''
+ global repository_datatypes_count
+ category = self.create_category( name=category_name, description=category_description )
+ self.logout()
+ self.login( email=common.test_user_1_email, username=common.test_user_1_name )
+ repository = self.get_or_create_repository( name=repository_name,
+ description=repository_description,
+ long_description=repository_long_description,
+ owner=common.test_user_1_name,
+ category_id=self.security.encode_id( category.id ),
+ strings_displayed=[] )
+ if self.repository_is_new( repository ):
+ self.upload_file( repository,
+ filename='proteomics_datatypes/proteomics_datatypes.tar',
+ filepath=None,
+ valid_tools_only=True,
+ uncompress_file=False,
+ remove_repo_files_not_in_tar=False,
+ commit_message='Uploaded datatype and sniffer definitions.',
+ strings_displayed=[],
+ strings_not_displayed=[] )
+ repository_datatypes_count = self.get_repository_datatypes_count( repository )
+
+ def test_0010_install_datatypes_repository( self ):
+ '''Install the proteomics_datatypes_1450 repository into the Galaxy instance.'''
+ '''
+ This includes steps 1 and 2 - Get a count of datatypes and sniffers.
+ Store a count of the current datatypes registry and sniffers in global variables, to compare with the updated count
+ after changing the installation status of the proteomics_datatypes_1450 repository.
+ '''
+ global repository_datatypes_count
+ global base_datatypes_count
+ global base_sniffers_count
+ base_sniffers_count = self.get_sniffers_count()
+ self.galaxy_logout()
+ self.galaxy_login( email=common.admin_email, username=common.admin_username )
+ strings_displayed = [ 'proteomics' ]
+ self.install_repository( 'proteomics_datatypes_1450',
+ common.test_user_1_name,
+ category_name,
+ strings_displayed=strings_displayed,
+ new_tool_panel_section='test_1450' )
+ installed_repository = test_db_util.get_installed_repository_by_name_owner( 'proteomics_datatypes_1450', common.test_user_1_name )
+ strings_displayed = [ 'user1',
+ self.url.replace( 'http://', '' ),
+ installed_repository.installed_changeset_revision ]
+ self.display_galaxy_browse_repositories_page( strings_displayed=strings_displayed )
+
+ def test_0015_verify_datatypes_count( self ):
+ '''Verify that datatypes were added in the previous step.'''
+ '''
+ This is step 3 - Verify the count of datatypes and sniffers is the previous count + the datatypes
+ contained within proteomics_datatypes_1450.
+ Compare the current datatypes registry and sniffers with the values that were retrieved in the previous step.
+ '''
+ current_datatypes = self.get_datatypes_count()
+ assert current_datatypes == base_datatypes_count + repository_datatypes_count, \
+ 'Found %d datatypes, expected %d.' % ( current_datatypes, base_datatypes_count + repository_datatypes_count )
+ current_sniffers = self.get_sniffers_count()
+ assert current_sniffers > base_sniffers_count, \
+ 'Sniffer count after installing proteomics_datatypes_1450 is %d, which is not greater than %d' % \
+ ( current_sniffers, base_sniffers_count )
+
+ def test_0020_deactivate_datatypes_repository( self ):
+ '''Deactivate the installed proteomics_datatypes_1450 repository.'''
+ '''
+ This is step 4 - Deactivate proteomics_datatypes_1450, verify the count of datatypes and sniffers is equal to
+ the count determined in step 1.
+ Deactivate proteomics_datatypes_1450 and check that the in-memory datatypes and sniffers match the base values
+ determined in the first step.
+ '''
+ repository = test_db_util.get_installed_repository_by_name_owner( repository_name, common.test_user_1_name )
+ global repository_datatypes_count
+ global base_datatypes_count
+ global base_sniffers_count
+ self.uninstall_repository( repository, remove_from_disk=False )
+ new_datatypes_count = self.get_datatypes_count()
+ assert new_datatypes_count == base_datatypes_count, 'Expected %d datatypes, got %d' % ( base_datatypes_count, new_datatypes_count )
+ current_sniffers = self.get_sniffers_count()
+ assert current_sniffers == base_sniffers_count, \
+ 'Sniffer count after deactivating proteomics_datatypes_1450 is %d, expected %d' % \
+ ( current_sniffers, base_sniffers_count )
+
+ def test_0025_reactivate_datatypes_repository( self ):
+ '''Reactivate the deactivated proteomics_datatypes_1450 repository.'''
+ '''
+ This is step 5 - Reactivate proteomics_datatypes, verify that the count of datatypes and sniffers has been
+ increased by the contents of the repository.
+ '''
+ repository = test_db_util.get_installed_repository_by_name_owner( repository_name, common.test_user_1_name )
+ global repository_datatypes_count
+ global base_datatypes_count
+ global base_sniffers_count
+ self.reactivate_repository( repository )
+ new_datatypes_count = self.get_datatypes_count()
+ assert new_datatypes_count == base_datatypes_count + repository_datatypes_count, \
+ 'Found %d datatypes, expected %d.' % ( new_datatypes_count, base_datatypes_count + repository_datatypes_count )
+ current_sniffers = self.get_sniffers_count()
+ assert current_sniffers > base_sniffers_count, \
+ 'Sniffer count after reactivating proteomics_datatypes_1450 is %d, which is not greater than %d' % \
+ ( current_sniffers, base_sniffers_count )
+
+ def test_0030_uninstall_datatypes_repository( self ):
+ '''Uninstall the installed proteomics_datatypes_1450 repository.'''
+ '''
+ This is step 6 - Uninstall proteomics_datatypes_1450, verify the count of datatypes and sniffers is equal
+ to the count determined in step 1.
+ Uninstall proteomics_datatypes_1450 and check that the in-memory datatypes and sniffers match the base values
+ determined in the first step.
+ '''
+ repository = test_db_util.get_installed_repository_by_name_owner( repository_name, common.test_user_1_name )
+ global repository_datatypes_count
+ global base_datatypes_count
+ self.uninstall_repository( repository, remove_from_disk=True )
+ new_datatypes_count = self.get_datatypes_count()
+ assert new_datatypes_count == base_datatypes_count, 'Expected %d datatypes, got %d' % ( base_datatypes_count, new_datatypes_count )
+ current_sniffers = self.get_sniffers_count()
+ assert current_sniffers == base_sniffers_count, \
+ 'Sniffer count after uninstalling proteomics_datatypes_1450 is %d, expected %d' % \
+ ( current_sniffers, base_sniffers_count )
+
+ def test_0035_reinstall_datatypes_repository( self ):
+ '''Reinstall the uninstalled proteomics_datatypes_1450 repository.'''
+ '''
+ This is step 7 - Reinstall proteomics_datatypes_1450, verify that the count of datatypes and sniffers has been
+ increased by the contents of the repository.
+ '''
+ repository = test_db_util.get_installed_repository_by_name_owner( repository_name, common.test_user_1_name )
+ global repository_datatypes_count
+ global base_datatypes_count
+ self.reinstall_repository( repository )
+ new_datatypes_count = self.get_datatypes_count()
+ assert new_datatypes_count == base_datatypes_count + repository_datatypes_count, \
+ 'Found %d datatypes, expected %d.' % ( new_datatypes_count, base_datatypes_count + repository_datatypes_count )
+ current_sniffers = self.get_sniffers_count()
+ assert current_sniffers > base_sniffers_count, \
+ 'Sniffer count after reinstalling proteomics_datatypes_1450 is %d, which is not greater than %d' % \
+ ( current_sniffers, base_sniffers_count )
+
+
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0