1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/d61dbf796cb5/ Changeset: d61dbf796cb5 User: carlfeberhard Date: 2015-02-16 19:25:03+00:00 Summary: History, API: allow purging with url parameter passing e.g. '...?purge=True', add test Affected #: 3 files diff -r a7d53e97af6fcdc4da90d20c897541771cecd963 -r d61dbf796cb5ca7500782e511490740c25010486 lib/galaxy/webapps/galaxy/api/histories.py --- a/lib/galaxy/webapps/galaxy/api/histories.py +++ b/lib/galaxy/webapps/galaxy/api/histories.py @@ -259,23 +259,23 @@ :type id: str :param id: the encoded id of the history to delete :type kwd: dict - :param kwd: (optional) dictionary structure containing: + :param kwd: (optional) dictionary structure containing extra parameters - * payload: a dictionary itself containing: - * purge: if True, purge the history and all of its HDAs + You can purge a history, removing all it's datasets from disk (if unshared), + by passing in ``purge=True`` in the url. :param keys: same as the use of `keys` in the `index` function above :param view: same as the use of `view` in the `index` function above :rtype: dict - :returns: an error object if an error occurred or a dictionary containing: - * id: the encoded id of the history, - * deleted: if the history was marked as deleted, - * purged: if the history was purged + :returns: the deleted or purged history """ history_id = id # a request body is optional here purge = False + if 'purge' in kwd: + purge = string_as_bool( kwd.get( 'purge' ) ) + # for backwards compat, keep the payload sub-dictionary if kwd.get( 'payload', None ): purge = string_as_bool( kwd['payload'].get( 'purge', False ) ) diff -r a7d53e97af6fcdc4da90d20c897541771cecd963 -r d61dbf796cb5ca7500782e511490740c25010486 test/casperjs/api-history-tests.js --- a/test/casperjs/api-history-tests.js +++ b/test/casperjs/api-history-tests.js @@ -118,7 +118,7 @@ "Id of last history (from index) DOES appear after undeletion: " + newFirstHistory.id ); //TODO: show, deleted flag - //TODO: delete, purge flag + // ------------------------------------------------------------------------------------------- UPDATE // ........................................................................................... name @@ -294,6 +294,28 @@ //this.test.comment( 'calling show with /deleted should raise a bad request' ); /* */ + + // ------------------------------------------------------------------------------------------- PURGE + var newHistoryId = null; + spaceghost.then( function(){ + this.test.comment( 'calling purge should mark a history, its datasets, and remove the files' ); + // create new history + var newHistory = this.api.histories.create({ name: 'To Purge' }); + newHistoryId = newHistory.id; + }); + spaceghost.openHomePage().api.tools.thenUploadToCurrent({ + filepath: '../../test-data/1.sam' + }); + spaceghost.then( function(){ + var recent = this.api.histories.show( newHistoryId ); + this.debug( 'size:\n' + recent.size ); + + this.api.assertRaises( function(){ + this.api.histories.delete_( recent.id, true ); + }, 403, 'This instance does not allow user dataset purging', 'Config does not allow thrown' ); + }); + //TODO: a way to set the config to allow user purging and then being able to test this would be good. + //this.debug( this.jsonStr( historyShow ) ); }); diff -r a7d53e97af6fcdc4da90d20c897541771cecd963 -r d61dbf796cb5ca7500782e511490740c25010486 test/casperjs/modules/api.js --- a/test/casperjs/modules/api.js +++ b/test/casperjs/modules/api.js @@ -267,10 +267,12 @@ this.api.spaceghost.info( 'histories.delete: ' + [ id, (( purge )?( '(purge!)' ):( '' )) ] ); // py.payload <-> ajax.data - var payload = ( purge )?({ purge: true }):({}); - return this.api._ajax( utils.format( this.urlTpls.delete_, this.api.ensureId( id ) ), { - type : 'DELETE', - data : payload + var url = utils.format( this.urlTpls.delete_, this.api.ensureId( id ) ); + if( purge ){ + url += '?purge=True'; + } + return this.api._ajax( url, { + type : 'DELETE' }); }; 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.