Skip to content

Commit

Permalink
fix options path
Browse files Browse the repository at this point in the history
  • Loading branch information
willronchetti committed Aug 28, 2024
1 parent 79f0606 commit d8036a6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 18 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "dcicsnovault"
version = "11.21.1.0b3"
version = "11.21.1.0b4"
description = "Storage support for 4DN Data Portals."
authors = ["4DN-DCIC Team <[email protected]>"]
license = "MIT"
Expand Down
15 changes: 3 additions & 12 deletions snovault/drs.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

DRS_VERSION_1 = 'v1'
DRS_PREFIX_V1 = f'ga4gh/drs/{DRS_VERSION_1}'
DRS_OBJECT_OPTIONS = DRS_PREFIX_V1 + '/options/{object_id}'
DRS_OBJECT_GET = DRS_PREFIX_V1 + '/objects/{object_id}'
DRS_OBJECT_GET_ACCESS_URL = DRS_PREFIX_V1 + '/objects/{object_id}/access/{access_id}'
DRS_OBJECT_GET_ACCESSS_URL_SLASH = DRS_PREFIX_V1 + '/objects/{object_id}/access/'
Expand All @@ -26,7 +25,6 @@


def includeme(config):
config.add_route('drs_options', '/' + DRS_OBJECT_OPTIONS)
config.add_route('drs_objects', '/' + DRS_OBJECT_GET)
config.add_route('drs_download', '/' + DRS_OBJECT_GET_ACCESS_URL)
config.add_route('drs_download_slash', '/' + DRS_OBJECT_GET_ACCESSS_URL_SLASH)
Expand Down Expand Up @@ -87,22 +85,15 @@ def get_drs_url(request, object_uri):


@view_config(
route_name='drs_options', request_method='OPTIONS'
)
@debug_log
def drs_options(context, request):
ignored(context), ignored(request)
return Response(status_code=204)


@view_config(
route_name='drs_objects', request_method='GET'
route_name='drs_objects', request_method=['GET', 'OPTIONS']
)
@debug_log
def drs_objects(context, request):
""" Implements DRS GET as specified by the API description
https://ga4gh.github.io/data-repository-service-schemas/preview/release/drs-1.0.0/docs/#_getobject
"""
if request.method == 'OPTIONS':
return Response(status_code=204)
drs_object_uri = '/' + request.matchdict['object_id']
formatted_drs_object = get_and_format_drs_object(request, drs_object_uri)
try:
Expand Down
7 changes: 2 additions & 5 deletions snovault/tests/test_drs.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,13 @@ class TestDRSAPI:
"""
BASE_URL = 'http://localhost:80/'

def test_drs_options(self, testapp):
""" Tests that the options endpoint returns 204 """
res = testapp.options('/ga4gh/drs/v1/options/blah', headers={'Content-Type': 'application/json'})
assert res.status_code == 204

def test_drs_get_object(self, testapp, testing_download): # noQA fixture
""" Tests basic structure about a drs object """
res = testapp.get(testing_download)
drs_object_uri = res.json['accession']
drs_object_uuid = res.json['uuid']
testapp.options(f'/ga4gh/drs/v1/objects/{drs_object_uri}',
headers={'Content-Type': 'application/json'}, status=204)
drs_object_1 = testapp.get(f'/ga4gh/drs/v1/objects/{drs_object_uri}').json
for key in REQUIRED_FIELDS:
assert key in drs_object_1
Expand Down

0 comments on commit d8036a6

Please sign in to comment.