@@ -74,7 +74,7 @@ class TestTerraNotebookUtilsDRS(SuppressWarningsMixin, unittest.TestCase):
74
74
jade_dev_url = "drs://jade.datarepo-dev.broadinstitute.org/v1_0c86170e-312d-4b39-a0a4-2a2bfaa24c7a_" \
75
75
"c0e40912-8b14-43f6-9a2f-b278144d0060"
76
76
77
- # martha_v3 responses
77
+ # drs_resolver responses
78
78
mock_jdr_response = {
79
79
'contentType' : 'application/octet-stream' ,
80
80
'size' : 15601108255 ,
@@ -92,7 +92,7 @@ class TestTerraNotebookUtilsDRS(SuppressWarningsMixin, unittest.TestCase):
92
92
'crc32c' : '8a366443'
93
93
}
94
94
}
95
- mock_martha_v3_response_missing_fields = {
95
+ mock_drs_resolver_response_missing_fields = {
96
96
'contentType' : 'application/octet-stream' ,
97
97
'bucket' : 'broad-jade-dev-data-bucket' ,
98
98
'name' : 'fd8d8492-ad02-447d-b54e-35a7ffd0e7a5/8b07563a-542f-4b5c-9e00-e8fe6b1861de' ,
@@ -107,7 +107,7 @@ class TestTerraNotebookUtilsDRS(SuppressWarningsMixin, unittest.TestCase):
107
107
'md5' : '336ea55913bc261b72875bd259753046' ,
108
108
}
109
109
}
110
- mock_martha_v3_response_without_gs_uri = {
110
+ mock_drs_resolver_response_without_gs_uri = {
111
111
'contentType' : 'application/octet-stream' ,
112
112
'bucket' : 'broad-jade-dev-data-bucket' ,
113
113
'googleServiceAccount' : {
@@ -119,7 +119,7 @@ class TestTerraNotebookUtilsDRS(SuppressWarningsMixin, unittest.TestCase):
119
119
'md5' : '336ea55913bc261b72875bd259753046' ,
120
120
}
121
121
}
122
- mock_martha_v3_error_response = {
122
+ mock_drs_resolver_error_response = {
123
123
"status" : 500 ,
124
124
"response" : {
125
125
"req" : {
@@ -144,7 +144,7 @@ class TestTerraNotebookUtilsDRS(SuppressWarningsMixin, unittest.TestCase):
144
144
"text" : "{\" msg\" :\" User 'null' does not have required action: read_data\" ,\" status_code\" :500}"
145
145
}
146
146
}
147
- mock_martha_v3_empty_error_response = {
147
+ mock_drs_resolver_empty_error_response = {
148
148
"status" : 500 ,
149
149
"response" : {
150
150
"status" : 500 ,
@@ -423,8 +423,8 @@ def test_arg_propagation(self):
423
423
drs .extract_tar_gz (self .drs_url )
424
424
enable_requester_pays .assert_called_with (WORKSPACE_NAME , WORKSPACE_NAMESPACE )
425
425
426
- # test for when we get everything what we wanted in martha_v3 response
427
- def test_martha_v3_response (self ):
426
+ # test for when we get everything what we wanted in drs_resolver response
427
+ def test_drs_resolver_response (self ):
428
428
resp_json = mock .MagicMock (return_value = self .mock_jdr_response )
429
429
requests_post = mock .MagicMock (return_value = mock .MagicMock (status_code = 200 , json = resp_json ))
430
430
with ExitStack () as es :
@@ -454,9 +454,9 @@ def test_martha_v2_response(self):
454
454
self .assertEqual (15601108255 , actual_info .size )
455
455
self .assertEqual ('2020-04-27T15:56:09.696Z' , actual_info .updated )
456
456
457
- # test for when some fields are missing in martha_v3 response
458
- def test_martha_v3_response_with_missing_fields (self ):
459
- resp_json = mock .MagicMock (return_value = self .mock_martha_v3_response_missing_fields )
457
+ # test for when some fields are missing in drs_resolver response
458
+ def test_drs_resolver_response_with_missing_fields (self ):
459
+ resp_json = mock .MagicMock (return_value = self .mock_drs_resolver_response_missing_fields )
460
460
requests_post = mock .MagicMock (return_value = mock .MagicMock (status_code = 200 , json = resp_json ))
461
461
with ExitStack () as es :
462
462
es .enter_context (mock .patch ("terra_notebook_utils.drs.gs.get_client" ))
@@ -485,10 +485,10 @@ def test_martha_v2_response_with_missing_fields(self):
485
485
self .assertEqual (None , actual_info .size )
486
486
self .assertEqual (None , actual_info .updated )
487
487
488
- # test for when 'gsUrl' is missing in martha_v3 response. It should throw error
488
+ # test for when 'gsUrl' is missing in drs_resolver response. It should throw error
489
489
@unittest .skip ("TODO: Test no gsUri _and_ no accessUrl" )
490
- def test_martha_v3_response_without_gs_uri (self ):
491
- resp_json = mock .MagicMock (return_value = self .mock_martha_v3_response_without_gs_uri )
490
+ def test_drs_resolver_response_without_gs_uri (self ):
491
+ resp_json = mock .MagicMock (return_value = self .mock_drs_resolver_response_without_gs_uri )
492
492
requests_post = mock .MagicMock (return_value = mock .MagicMock (status_code = 200 , json = resp_json ))
493
493
with ExitStack () as es :
494
494
es .enter_context (mock .patch ("terra_notebook_utils.drs.gs.get_client" ))
@@ -506,19 +506,19 @@ def test_martha_v2_response_without_gs_uri(self):
506
506
with self .assertRaisesRegex (Exception , f"No GS url found for DRS uri '{ self .drs_url } '" ):
507
507
drs .get_drs_blob (self .drs_url )
508
508
509
- # test for when martha_v3 returns error. It should throw error
510
- def test_martha_v3_error_response (self ):
511
- resp_json = mock .MagicMock (return_value = self .mock_martha_v3_error_response )
509
+ # test for when drs_resolver returns error. It should throw error
510
+ def test_drs_resolver_error_response (self ):
511
+ resp_json = mock .MagicMock (return_value = self .mock_drs_resolver_error_response )
512
512
requests_post = mock .MagicMock (return_value = mock .MagicMock (status_code = 500 , json = resp_json ))
513
513
with ExitStack () as es :
514
514
es .enter_context (mock .patch ("terra_notebook_utils.drs.gs.get_client" ))
515
515
es .enter_context (mock .patch ("terra_notebook_utils.drs.http" , post = requests_post ))
516
516
with self .assertRaises (drs .DRSResolutionError ):
517
517
drs .get_drs_blob (self .jade_dev_url )
518
518
519
- # test for when martha_v3 returns error response with 'text' field. It should throw error
520
- def test_martha_v3_empty_error_response (self ):
521
- resp_json = mock .MagicMock (return_value = self .mock_martha_v3_empty_error_response )
519
+ # test for when drs_resolver returns error response with 'text' field. It should throw error
520
+ def test_drs_resolver_empty_error_response (self ):
521
+ resp_json = mock .MagicMock (return_value = self .mock_drs_resolver_empty_error_response )
522
522
requests_post = mock .MagicMock (return_value = mock .MagicMock (status_code = 500 , json = resp_json ))
523
523
with ExitStack () as es :
524
524
es .enter_context (mock .patch ("terra_notebook_utils.drs.gs.get_client" ))
@@ -570,7 +570,8 @@ def test_access(self):
570
570
response = requests .get (signed_url , headers = {'Range' : 'bytes=0-1' })
571
571
response .raise_for_status ()
572
572
# Test a Jade resource
573
- # requires that GOOGLE_APPLICATION_CREDENTIALS be set, because martha does not return a service account
573
+ # requires that GOOGLE_APPLICATION_CREDENTIALS be set
574
+ # because neither martha nor DRSHub returns a service account
574
575
jade_uri = 'drs://jade-terra.datarepo-prod.broadinstitute.org/' \
575
576
'v1_c3c588a8-be3f-467f-a244-da614be6889a_635984f0-3267-4201-b1ee-d82f64b8e6d1'
576
577
with self .subTest (f'Testing DRS Access: { jade_uri } ' ):
0 commit comments