commit/galaxy-central: 2 new changesets
2 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/d7c19ee54a91/ Changeset: d7c19ee54a91 User: jmchilton Date: 2014-09-05 02:34:52 Summary: More fixes for library permissions backward compatiblity. Fixes failing test in test/api/test_history_contents.py. Affected #: 2 files diff -r 6a718b389bf1caa5461c5ff7a7dd644f1279cd69 -r d7c19ee54a9167b97f99eb83c2600f35abdea312 lib/galaxy/webapps/galaxy/api/libraries.py --- a/lib/galaxy/webapps/galaxy/api/libraries.py +++ b/lib/galaxy/webapps/galaxy/api/libraries.py @@ -284,6 +284,7 @@ action = kwd.get( 'action', None ) if action is None: payload = kwd.get( 'payload', None ) + del kwd[ 'payload' ] if payload is not None: return self.set_permissions_old( trans, library, payload, **kwd ) else: @@ -368,6 +369,7 @@ POST /api/libraries/{encoded_library_id}/permissions Updates the library permissions. """ + import galaxy.util params = galaxy.util.Params( payload ) permissions = {} for k, v in trans.app.model.Library.permitted_actions.items(): diff -r 6a718b389bf1caa5461c5ff7a7dd644f1279cd69 -r d7c19ee54a9167b97f99eb83c2600f35abdea312 lib/galaxy/webapps/galaxy/buildapp.py --- a/lib/galaxy/webapps/galaxy/buildapp.py +++ b/lib/galaxy/webapps/galaxy/buildapp.py @@ -299,11 +299,6 @@ path_prefix='/api/libraries/:library_id', parent_resources=dict( member_name='library', collection_name='libraries' ) ) - webapp.mapper.resource( 'permission', - 'permissions', - path_prefix='/api/libraries/:library_id', - parent_resources=dict( member_name='library', collection_name='libraries' ) ) - _add_item_extended_metadata_controller( webapp, name_prefix="library_dataset_", path_prefix='/api/libraries/:library_id/contents/:library_content_id' ) https://bitbucket.org/galaxy/galaxy-central/commits/0df64c45db90/ Changeset: 0df64c45db90 User: jmchilton Date: 2014-09-05 02:34:52 Summary: Remove abstraction around requests now that it is a required dependency. Affected #: 7 files diff -r d7c19ee54a9167b97f99eb83c2600f35abdea312 -r 0df64c45db90ca84e763c34919ebe9304d96f202 test/api/test_authenticate.py --- a/test/api/test_authenticate.py +++ b/test/api/test_authenticate.py @@ -1,6 +1,6 @@ import base64 -from base.interactor import get_request +from requests import get from base import api @@ -18,12 +18,12 @@ headers = { "Authorization": authorization, } - auth_response = get_request( baseauth_url, headers=headers ) + auth_response = get( baseauth_url, headers=headers ) self._assert_status_code_is( auth_response, 200 ) auth_dict = auth_response.json() self._assert_has_keys( auth_dict, "api_key" ) # Verify key... random_api_url = self._api_url( "users", use_key=False ) - random_api_response = get_request( random_api_url, params=dict( key=auth_dict[ "api_key" ] ) ) + random_api_response = get( random_api_url, params=dict( key=auth_dict[ "api_key" ] ) ) self._assert_status_code_is( random_api_response, 200 ) diff -r d7c19ee54a9167b97f99eb83c2600f35abdea312 -r 0df64c45db90ca84e763c34919ebe9304d96f202 test/api/test_histories.py --- a/test/api/test_histories.py +++ b/test/api/test_histories.py @@ -1,8 +1,7 @@ from base import api -# requests.{post,put,get} or something like it if unavailable -from base.interactor import post_request -from base.interactor import put_request -from base.interactor import get_request +from requests import post +from requests import put +from requests import get from .helpers import DatasetPopulator, wait_on @@ -29,7 +28,7 @@ post_data = dict( name="CannotCreate" ) # Using lower-level _api_url will cause key to not be injected. histories_url = self._api_url( "histories" ) - create_response = post_request( url=histories_url, data=post_data ) + create_response = post( url=histories_url, data=post_data ) self._assert_status_code_is( create_response, 403 ) def test_import_export( self ): @@ -38,7 +37,7 @@ self.dataset_populator.wait_for_history( history_id, assert_ok=True ) download_path = self._export( history_id ) full_download_url = "%s%s?key=%s" % ( self.url, download_path, self.galaxy_interactor.api_key ) - download_response = get_request( full_download_url ) + download_response = get( full_download_url ) self._assert_status_code_is( download_response, 200 ) def history_names(): @@ -72,11 +71,11 @@ def _export(self, history_id): export_url = self._api_url( "histories/%s/exports" % history_id, use_key=True ) - put_response = put_request( export_url ) + put_response = put( export_url ) self._assert_status_code_is( put_response, 202 ) def export_ready_response(): - put_response = put_request( export_url ) + put_response = put( export_url ) if put_response.status_code == 202: return None return put_response diff -r d7c19ee54a9167b97f99eb83c2600f35abdea312 -r 0df64c45db90ca84e763c34919ebe9304d96f202 test/api/test_history_contents.py --- a/test/api/test_history_contents.py +++ b/test/api/test_history_contents.py @@ -4,10 +4,8 @@ from .helpers import TestsDatasets from .helpers import LibraryPopulator from .helpers import DatasetCollectionPopulator -from base.interactor import ( - put_request, - delete_request, -) +from requests import delete +from requests import put # TODO: Test anonymous access. @@ -72,7 +70,7 @@ update_url = self._api_url( "histories/%s/contents/%s" % ( self.history_id, hda1[ "id" ] ), use_key=True ) # Awkward json.dumps required here because of https://trello.com/c/CQwmCeG6 body = json.dumps( dict( deleted=True ) ) - update_response = put_request( update_url, data=body ) + update_response = put( update_url, data=body ) self._assert_status_code_is( update_response, 200 ) show_response = self.__show( hda1 ) assert str( show_response.json()[ "deleted" ] ).lower() == "true" @@ -82,7 +80,7 @@ self._wait_for_history( self.history_id ) assert str( self.__show( hda1 ).json()[ "deleted" ] ).lower() == "false" url = self._api_url( "histories/%s/contents/%s" % ( self.history_id, hda1["id" ] ), use_key=True ) - delete_response = delete_request( url ) + delete_response = delete( url ) assert delete_response.status_code < 300 # Something in the 200s :). assert str( self.__show( hda1 ).json()[ "deleted" ] ).lower() == "true" @@ -119,7 +117,7 @@ assert not dataset_collection[ "deleted" ] - delete_response = delete_request( self._api_url( collection_url, use_key=True ) ) + delete_response = delete( self._api_url( collection_url, use_key=True ) ) self._assert_status_code_is( delete_response, 200 ) show_response = self._get( collection_url ) @@ -137,7 +135,7 @@ 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 ) + update_response = put( update_url, data=body ) self._assert_status_code_is( update_response, 200 ) show_response = self.__show( hdca ) assert str( show_response.json()[ "name" ] ) == "newnameforpair" diff -r d7c19ee54a9167b97f99eb83c2600f35abdea312 -r 0df64c45db90ca84e763c34919ebe9304d96f202 test/api/test_pages.py --- a/test/api/test_pages.py +++ b/test/api/test_pages.py @@ -1,6 +1,6 @@ from galaxy.exceptions import error_codes from base import api -from base.interactor import delete_request +from requests import delete from operator import itemgetter @@ -68,17 +68,17 @@ def test_delete( self ): response_json = self._create_valid_page_with_slug( "testdelete" ) - delete_response = delete_request( self._api_url( "pages/%s" % response_json[ 'id' ], use_key=True ) ) + delete_response = delete( self._api_url( "pages/%s" % response_json[ 'id' ], use_key=True ) ) self._assert_status_code_is( delete_response, 200 ) def test_404_on_delete_unknown_page( self ): - delete_response = delete_request( self._api_url( "pages/%s" % self._random_key(), use_key=True ) ) + delete_response = delete( self._api_url( "pages/%s" % self._random_key(), use_key=True ) ) self._assert_status_code_is( delete_response, 404 ) self._assert_error_code_is( delete_response, error_codes.USER_OBJECT_NOT_FOUND ) def test_403_on_delete_unowned_page( self ): page_response = self._create_valid_page_as( "others_page@bx.psu.edu", "otherspage" ) - delete_response = delete_request( self._api_url( "pages/%s" % page_response[ "id" ], use_key=True ) ) + delete_response = delete( self._api_url( "pages/%s" % page_response[ "id" ], use_key=True ) ) self._assert_status_code_is( delete_response, 403 ) self._assert_error_code_is( delete_response, error_codes.USER_DOES_NOT_OWN_ITEM ) diff -r d7c19ee54a9167b97f99eb83c2600f35abdea312 -r 0df64c45db90ca84e763c34919ebe9304d96f202 test/api/test_search.py --- a/test/api/test_search.py +++ b/test/api/test_search.py @@ -1,5 +1,5 @@ from base import api -from base.interactor import delete_request +from requests import delete from .helpers import WorkflowPopulator @@ -14,7 +14,7 @@ # Deleted delete_url = self._api_url( "workflows/%s" % workflow_id, use_key=True ) - delete_request( delete_url ) + delete( delete_url ) search_response = self.__search( "select * from workflow where deleted = False" ) assert not self.__has_result_with_name( search_response, "test_for_search (imported from API)" ), search_response.json() diff -r d7c19ee54a9167b97f99eb83c2600f35abdea312 -r 0df64c45db90ca84e763c34919ebe9304d96f202 test/api/test_workflows.py --- a/test/api/test_workflows.py +++ b/test/api/test_workflows.py @@ -8,7 +8,8 @@ from .helpers import DatasetCollectionPopulator from .helpers import skip_without_tool -from base.interactor import delete_request # requests like delete +from requests import delete + from galaxy.exceptions import error_codes @@ -40,7 +41,7 @@ workflow_name = "test_delete (imported from API)" self._assert_user_has_workflow_with_name( workflow_name ) workflow_url = self._api_url( "workflows/%s" % workflow_id, use_key=True ) - delete_response = delete_request( workflow_url ) + delete_response = delete( workflow_url ) self._assert_status_code_is( delete_response, 200 ) # Make sure workflow is no longer in index by default. assert workflow_name not in self.__workflow_names() @@ -49,7 +50,7 @@ workflow_id = self.workflow_populator.simple_workflow( "test_other_delete" ) with self._different_user(): workflow_url = self._api_url( "workflows/%s" % workflow_id, use_key=True ) - delete_response = delete_request( workflow_url ) + delete_response = delete( workflow_url ) self._assert_status_code_is( delete_response, 403 ) def test_index( self ): diff -r d7c19ee54a9167b97f99eb83c2600f35abdea312 -r 0df64c45db90ca84e763c34919ebe9304d96f202 test/base/interactor.py --- a/test/base/interactor.py +++ b/test/base/interactor.py @@ -10,7 +10,9 @@ import galaxy.model from galaxy.model.orm import and_, desc from functional import database_contexts -from json import dumps, loads +from requests import get +from requests import post +from json import dumps from logging import getLogger log = getLogger( __name__ ) @@ -366,7 +368,7 @@ key = self.api_key if not admin else self.master_api_key data = data.copy() data['key'] = key - return post_request( "%s/%s" % (self.api_url, path), data=data, files=files ) + return post( "%s/%s" % (self.api_url, path), data=data, files=files ) def _get( self, path, data={}, key=None, admin=False ): if not key: @@ -376,7 +378,7 @@ if path.startswith("/api"): path = path[ len("/api"): ] url = "%s/%s" % (self.api_url, path) - return get_request( url, params=data ) + return get( url, params=data ) class GalaxyInteractorTwill( object ): @@ -496,9 +498,3 @@ 'api': GalaxyInteractorApi, 'twill': GalaxyInteractorTwill, } - - -from requests import get as get_request -from requests import post as post_request -from requests import put as put_request -from requests import delete as delete_request 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