commit/galaxy-central: 2 new changesets
2 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/001bef06c8ee/ Changeset: 001bef06c8ee Branch: next-stable User: carlfeberhard Date: 2014-04-07 16:10:26 Summary: Fix encoding/serialization of returned data from HDA create API Affected #: 2 files diff -r 77e39831c60b1c5fa0e3a6a8612ff80f9d70aab9 -r 001bef06c8eeb9561a96dad3e76d33569918efda 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 @@ -254,7 +254,13 @@ hda = history.add_dataset( data_copy ) trans.sa_session.flush() - return hda.to_dict() if hda else None + if not hda: + return None + #TODO: duplicate code - use a serializer with a view + hda_dict = self.get_hda_dict( trans, hda ) + hda_dict[ 'display_types' ] = self.get_old_display_applications( trans, hda ) + hda_dict[ 'display_apps' ] = self.get_display_apps( trans, hda ) + return hda_dict @expose_api_anonymous def update( self, trans, history_id, id, payload, **kwd ): diff -r 77e39831c60b1c5fa0e3a6a8612ff80f9d70aab9 -r 001bef06c8eeb9561a96dad3e76d33569918efda test/casperjs/api-hda-tests.js --- a/test/casperjs/api-hda-tests.js +++ b/test/casperjs/api-hda-tests.js @@ -39,7 +39,7 @@ }); // =================================================================== TESTS -var summaryKeys = [ 'id', 'name', 'type', 'url' ], +var summaryKeys = [ 'id', 'name', 'history_id', 'state', 'deleted', 'purged', 'visible', 'url', 'type' ], detailKeys = [ // the following are always present regardless of datatype 'id', 'name', 'api_type', 'model_class', @@ -100,6 +100,18 @@ // ------------------------------------------------------------------------------------------- CREATE //TODO: create from_ld_id + this.test.comment( 'create should allow copying an accessible hda' ); + hdaShow = this.api.hdas.show( lastHistory.id, firstHda.id ); + var returned = this.api.hdas.create( lastHistory.id, { + source : 'hda', + content : hdaShow.id + }); + //this.debug( 'returned:' + this.jsonStr( returned ) ); + this.test.assert( this.hasKeys( returned, detailKeys ), 'Has the proper keys' ); + this.test.assert( typeof returned.id !== 'number' && isNaN( Number( returned.id ) ), + 'id seems to be encoded: ' + returned.id ); + this.test.assert( typeof returned.history_id !== 'number' && isNaN( Number( returned.history_id ) ), + 'history_id seems to be encoded: ' + returned.history_id ); // ------------------------------------------------------------------------------------------- UPDATE https://bitbucket.org/galaxy/galaxy-central/commits/a6b0ca587908/ Changeset: a6b0ca587908 User: carlfeberhard Date: 2014-04-07 16:11:07 Summary: merge next-stable Affected #: 2 files diff -r 1768cbdd144df553f1173b22ea1961ec5054f1c0 -r a6b0ca587908e40b518e836fe952588adb0b867f 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 @@ -254,7 +254,13 @@ hda = history.add_dataset( data_copy ) trans.sa_session.flush() - return hda.to_dict() if hda else None + if not hda: + return None + #TODO: duplicate code - use a serializer with a view + hda_dict = self.get_hda_dict( trans, hda ) + hda_dict[ 'display_types' ] = self.get_old_display_applications( trans, hda ) + hda_dict[ 'display_apps' ] = self.get_display_apps( trans, hda ) + return hda_dict @expose_api_anonymous def update( self, trans, history_id, id, payload, **kwd ): diff -r 1768cbdd144df553f1173b22ea1961ec5054f1c0 -r a6b0ca587908e40b518e836fe952588adb0b867f test/casperjs/api-hda-tests.js --- a/test/casperjs/api-hda-tests.js +++ b/test/casperjs/api-hda-tests.js @@ -39,7 +39,7 @@ }); // =================================================================== TESTS -var summaryKeys = [ 'id', 'name', 'type', 'url' ], +var summaryKeys = [ 'id', 'name', 'history_id', 'state', 'deleted', 'purged', 'visible', 'url', 'type' ], detailKeys = [ // the following are always present regardless of datatype 'id', 'name', 'api_type', 'model_class', @@ -100,6 +100,18 @@ // ------------------------------------------------------------------------------------------- CREATE //TODO: create from_ld_id + this.test.comment( 'create should allow copying an accessible hda' ); + hdaShow = this.api.hdas.show( lastHistory.id, firstHda.id ); + var returned = this.api.hdas.create( lastHistory.id, { + source : 'hda', + content : hdaShow.id + }); + //this.debug( 'returned:' + this.jsonStr( returned ) ); + this.test.assert( this.hasKeys( returned, detailKeys ), 'Has the proper keys' ); + this.test.assert( typeof returned.id !== 'number' && isNaN( Number( returned.id ) ), + 'id seems to be encoded: ' + returned.id ); + this.test.assert( typeof returned.history_id !== 'number' && isNaN( Number( returned.history_id ) ), + 'history_id seems to be encoded: ' + returned.history_id ); // ------------------------------------------------------------------------------------------- UPDATE 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.
participants (1)
-
commits-noreply@bitbucket.org