Skip to content

Commit

Permalink
Change endpoint to api/tools/<tool_id>/dependencies
Browse files Browse the repository at this point in the history
A POST will trigger installation and DELETE will trigger uninstalling
the dependencies (Thx for the suggestion @jmchilton).
  • Loading branch information
mvdbeek committed Mar 12, 2017
1 parent 3b067ef commit d5b5d29
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
8 changes: 6 additions & 2 deletions lib/galaxy/webapps/galaxy/api/tools.py
Expand Up @@ -135,7 +135,11 @@ def requirements(self, trans, id, **kwds):
@web.require_admin
def install_dependencies(self, trans, id, **kwds):
"""
POST /api/tools/{tool_id}/install_dependencies
POST /api/tools/{tool_id}/dependencies
This endpoint is also available through POST /api/tools/{tool_id}/install_dependencies,
but will be deprecated in the future.
Attempts to install requirements via the dependency resolver
parameters:
Expand All @@ -154,7 +158,7 @@ def install_dependencies(self, trans, id, **kwds):
@web.require_admin
def uninstall_dependencies(self, trans, id, **kwds):
"""
POST /api/tools/{tool_id}/uninstall_dependencies
DELETE /api/tools/{tool_id}/dependencies
Attempts to uninstall requirements via the dependency resolver
"""
Expand Down
3 changes: 2 additions & 1 deletion lib/galaxy/webapps/galaxy/buildapp.py
Expand Up @@ -269,7 +269,8 @@ def populate_api_routes( webapp, app ):
webapp.mapper.connect( '/api/tools/{id:.+?}/download', action='download', controller="tools" )
webapp.mapper.connect( '/api/tools/{id:.+?}/requirements', action='requirements', controller="tools")
webapp.mapper.connect( '/api/tools/{id:.+?}/install_dependencies', action='install_dependencies', controller="tools", conditions=dict( method=[ "POST" ] ))
webapp.mapper.connect( '/api/tools/{id:.+?}/uninstall_dependencies', action='uninstall_dependencies', controller="tools", conditions=dict( method=[ "POST" ] ))
webapp.mapper.connect( '/api/tools/{id:.+?}/dependencies', action='install_dependencies', controller="tools", conditions=dict( method=[ "POST" ] ))
webapp.mapper.connect( '/api/tools/{id:.+?}/dependencies', action='uninstall_dependencies', controller="tools", conditions=dict( method=[ "DELETE" ] ))
webapp.mapper.connect( '/api/tools/{id:.+?}/build_dependency_cache', action='build_dependency_cache', controller="tools", conditions=dict( method=[ "POST" ] ))
webapp.mapper.connect( '/api/tools/{id:.+?}', action='show', controller="tools" )
webapp.mapper.resource( 'tool', 'tools', path_prefix='/api' )
Expand Down
6 changes: 3 additions & 3 deletions test/integration/test_resolvers.py
Expand Up @@ -120,14 +120,14 @@ def test_conda_install_through_tools_api( self ):

def test_uninstall_through_tools_api(self):
tool_id = 'mulled_example_multi_1'
endpoint = "tools/%s/install_dependencies" % tool_id
endpoint = "tools/%s/dependencies" % tool_id
data = {'id': tool_id}
create_response = self._post(endpoint, data=data, admin=True)
self._assert_status_code_is( create_response, 200 )
response = create_response.json()
assert any([True for d in response if d['dependency_type'] == 'conda'])
endpoint = "tools/%s/uninstall_dependencies" % tool_id
create_response = self._post(endpoint, data=data, admin=True)
endpoint = "tools/%s/dependencies" % tool_id
create_response = self._delete(endpoint, data=data, admin=True)
self._assert_status_code_is(create_response, 200)
response = create_response.json()
assert not [True for d in response if d['dependency_type'] == 'conda']
Expand Down

0 comments on commit d5b5d29

Please sign in to comment.