commit/galaxy-central: jmchilton: Bugfix for updating history dataset collection name.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/6b86b4186c45/ Changeset: 6b86b4186c45 User: jmchilton Date: 2014-05-14 12:26:21 Summary: Bugfix for updating history dataset collection name. Thanks to Bjoern for the bug report. This attribute had been DatasetCollection in earlier versions of this code and the update code was only partially cut-over to use the new location for name (on HistoryDatasetCollectionAssociation). Affected #: 2 files diff -r e0d69ca8be55cd8cfd863ad7f128e95a42eabfd3 -r 6b86b4186c455317cba726c7ad6579a030922421 lib/galaxy/model/__init__.py --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -2636,20 +2636,8 @@ return new_collection def set_from_dict( self, new_data ): - editable_keys = ( 'name' ) - changed = {} - - # unknown keys are ignored here - for key in [ k for k in new_data.keys() if k in editable_keys ]: - new_val = new_data[ key ] - old_val = self.__getattribute__( key ) - if new_val == old_val: - continue - - self.__setattr__( key, new_val ) - changed[ key ] = new_val - - return changed + # Nothing currently editable in this class. + return {} class DatasetCollectionInstance( object, HasName ): diff -r e0d69ca8be55cd8cfd863ad7f128e95a42eabfd3 -r 6b86b4186c455317cba726c7ad6579a030922421 test/api/test_history_contents.py --- a/test/api/test_history_contents.py +++ b/test/api/test_history_contents.py @@ -128,12 +128,28 @@ dataset_collection = show_response.json() assert dataset_collection[ "deleted" ] - def __show( self, hda ): - show_response = self._get( "histories/%s/contents/%s" % ( self.history_id, hda[ "id" ] ) ) + def test_update_dataset_collection( self ): + payload = self.dataset_collection_populator.create_pair_payload( + self.history_id, + type="dataset_collection" + ) + dataset_collection_response = self._post( "histories/%s/contents" % self.history_id, payload ) + self._assert_status_code_is( dataset_collection_response, 200 ) + hdca = dataset_collection_response.json() + update_url = self._api_url( "histories/%s/contents/dataset_collections/%s" % ( self.history_id, hdca[ "id" ] ), use_key=True ) + # Awkward json.dumps required here because of https://trello.com/c/CQwmCeG6 + body = json.dumps( dict( name="newnameforpair" ) ) + update_response = put_request( update_url, data=body ) + self._assert_status_code_is( update_response, 200 ) + show_response = self.__show( hdca ) + assert str( show_response.json()[ "name" ] ) == "newnameforpair" + + def __show( self, contents ): + show_response = self._get( "histories/%s/contents/%ss/%s" % ( self.history_id, contents["history_content_type"], contents[ "id" ] ) ) return show_response def __count_contents( self, history_id=None, **kwds ): - if history_id == None: + if history_id is None: history_id = self.history_id contents_response = self._get( "histories/%s/contents" % history_id, kwds ) return len( contents_response.json() ) 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