mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-11-03 12:53:35 +08:00
Fix DRS tests to mock access endpoint
The access_id resolution logic now prefers fetching from /access/{id}
when present, so tests need to mock that endpoint rather than providing
inline access_url in the object response.
This commit is contained in:
@@ -28,16 +28,20 @@ def test_file_source_drs_http():
|
||||
"access_methods": [
|
||||
{
|
||||
"type": "https",
|
||||
"access_url": {
|
||||
"url": "https://my.respository.org/myfile.txt",
|
||||
"headers": ["Authorization: Basic Z2E0Z2g6ZHJz"],
|
||||
},
|
||||
"access_id": "1234",
|
||||
}
|
||||
],
|
||||
}
|
||||
return (200, {}, json.dumps(data))
|
||||
|
||||
def access_handler(request):
|
||||
assert request.headers["Authorization"] == "Bearer IBearTokens"
|
||||
access_data = {
|
||||
"url": "https://my.respository.org/myfile.txt",
|
||||
"headers": ["Authorization: Basic Z2E0Z2g6ZHJz"],
|
||||
}
|
||||
return (200, {}, json.dumps(access_data))
|
||||
|
||||
responses.add_callback(
|
||||
responses.GET,
|
||||
"https://drs.example.org/ga4gh/drs/v1/objects/314159",
|
||||
@@ -45,6 +49,13 @@ def test_file_source_drs_http():
|
||||
content_type="application/json",
|
||||
)
|
||||
|
||||
responses.add_callback(
|
||||
responses.GET,
|
||||
"https://drs.example.org/ga4gh/drs/v1/objects/314159/access/1234",
|
||||
callback=access_handler,
|
||||
content_type="application/json",
|
||||
)
|
||||
|
||||
test_url = "drs://drs.example.org/314159"
|
||||
|
||||
def check_specific_header(request, **kwargs):
|
||||
@@ -76,9 +87,6 @@ def test_file_source_drs_s3():
|
||||
"access_methods": [
|
||||
{
|
||||
"type": "s3",
|
||||
"access_url": {
|
||||
"url": "s3://ga4gh-demo-data/phenopackets/Cao-2018-TGFBR2-Patient_4.json",
|
||||
},
|
||||
"access_id": "1234",
|
||||
"region": "us-east-1",
|
||||
}
|
||||
@@ -86,6 +94,13 @@ def test_file_source_drs_s3():
|
||||
}
|
||||
return (200, {}, json.dumps(data))
|
||||
|
||||
def access_handler(request):
|
||||
assert request.headers["Authorization"] == "Bearer IBearTokens"
|
||||
access_data = {
|
||||
"url": "s3://ga4gh-demo-data/phenopackets/Cao-2018-TGFBR2-Patient_4.json",
|
||||
}
|
||||
return (200, {}, json.dumps(access_data))
|
||||
|
||||
responses.add_callback(
|
||||
responses.GET,
|
||||
"https://drs.example.org/ga4gh/drs/v1/objects/314160",
|
||||
@@ -93,6 +108,13 @@ def test_file_source_drs_s3():
|
||||
content_type="application/json",
|
||||
)
|
||||
|
||||
responses.add_callback(
|
||||
responses.GET,
|
||||
"https://drs.example.org/ga4gh/drs/v1/objects/314160/access/1234",
|
||||
callback=access_handler,
|
||||
content_type="application/json",
|
||||
)
|
||||
|
||||
test_url = "drs://drs.example.org/314160"
|
||||
file_sources = configured_file_sources(FILE_SOURCES_CONF)
|
||||
user_context = user_context_fixture(file_sources=file_sources)
|
||||
|
||||
Reference in New Issue
Block a user