@@ -120,9 +120,9 @@ def test_index_no_parameters(client, user, mock_arborist_requests, is_rbac_confi
120120 assert data_all_by_md .status_code == 403 , f"Expected status code 403, got { data_all_by_md .status_code } "
121121
122122
123- def test_drs_no_parameters (client , user , mock_arborist_requests , is_rbac_configured ):
123+ def test_multiple_endpoints (client , user , mock_arborist_requests , is_rbac_configured ):
124124 """
125- Test that the index endpoint without parameters returns expected projects .
125+ Test multiple endpoints, ensure rbac .
126126 """
127127 if not is_rbac_configured :
128128 pytest .skip ("RBAC is not configured, skipping test." )
@@ -206,52 +206,51 @@ def test_drs_no_parameters(client, user, mock_arborist_requests, is_rbac_configu
206206
207207# start other-checks
208208
209+ print (f"DEBUG >>>>>> User should not have access to /index/urls" , file = sys .stderr )
209210 urls = client .get ("/index/urls" , headers = user )
210211 assert urls .status_code == 404 , f"Expected status code 404, got { urls .status_code } "
211212 urls = urls .json
212-
213- print (f"DEBUG >>>>>> User should not have access to any records { urls } " , file = sys .stderr )
214213 assert 'error' in urls , f"Expected 'error' in response, got { urls } "
215214 assert urls ['error' ] == 'no record found' , f"Expected 'no record found', got { urls ['error' ]} "
216215
216+ print (f"DEBUG >>>>>> User should not have access to /index/{ res2_did } " , file = sys .stderr )
217217 data_2 = client .get (f"/index/{ res2_did } " , headers = user )
218218 assert data_2 .status_code == 403 , f"Expected status code 403, got { data_2 .status_code } "
219219 data_2 = data_2 .json
220-
221- print (f"DEBUG >>>>>> User should not have access to any records { urls } " , file = sys .stderr )
222220 assert 'error' in data_2 , f"Expected 'error' in response, got { data_2 } "
223221 assert data_2 ['error' ] == 'User is not authorized for any resources' , f"Expected 'User is not authorized for any resources', got { data_2 ['error' ]} "
224222
225- # ' index/ga4gh/dos/v1/dataobjects'
223+ print ( f"DEBUG >>>>>> User should not have access to / index/ga4gh/dos/v1/dataobjects/ { res2_did } " , file = sys . stderr )
226224 dataobjects = client .get (f"/index/ga4gh/dos/v1/dataobjects/{ res2_did } " , headers = user )
227225 assert dataobjects .status_code == 404 , f"Expected status code 404, got { dataobjects .status_code } "
228226 dataobjects = dataobjects .json
229227 assert 'error' in dataobjects , f"Expected 'error' in response, got { dataobjects } "
230228 assert dataobjects ['error' ] == 'no record found' , f"Expected 'no record found', got { dataobjects ['error' ]} "
231229
232- # ' index/bundle'
230+ print ( f"DEBUG >>>>>> User should not have access to index/bundle" , file = sys . stderr )
233231 bundles = client .get (f"/index/bundle" , headers = user )
234232 assert bundles .status_code == 404 , f"Expected status code 404, got { bundles .status_code } "
235233 bundles = bundles .json
236234 assert 'error' in bundles , f"Expected 'error' in response, got { bundles } "
237235 assert bundles ['error' ] == 'no record found' , f"Expected 'no record found', got { bundles ['error' ]} "
238236
239- # ' index/index/5dbfb135-3362-5b29-85fe-cc30e0b6e7c3 /aliases'
237+ print ( f"DEBUG >>>>>> User should not have access to index/index/{ res2_did } /aliases" , file = sys . stderr )
240238 aliases = client .get (f"index/index/{ res2_did } /aliases" , headers = user )
241239 assert aliases .status_code == 404 , f"Expected status code 404, got { aliases .status_code } "
242240 aliases = aliases .json
243241 assert 'error' in aliases , f"Expected 'error' in response, got { aliases } "
244242 assert aliases ['error' ] == f"index/{ res2_did } " , f"Expected 'index/{ res2_did } ', got { aliases } "
245243
246- # ' index/_stats'
244+ print ( f"DEBUG >>>>>> User should not have access to index/_stats" , file = sys . stderr )
247245 _stats = client .get (f"index/_stats" , headers = user )
248246 assert _stats .status_code == 404 , f"Expected status code 404, got { _stats .status_code } "
249247 _stats = _stats .json
250248 assert 'error' in _stats , f"Expected 'error' in response, got { _stats } "
251249 assert _stats ['error' ] == 'no record found' , f"Expected 'no record found', got { _stats } "
252250
253- # end other-checks
251+ # end other-checks
254252
253+ print (f"DEBUG >>>>>> User should not have access to /ga4gh/drs/v1/objects/{ res2_did } " , file = sys .stderr )
255254 data_2 = client .get (f"/ga4gh/drs/v1/objects/{ res2_did } " , headers = user )
256255 assert data_2 .status_code == 403 , f"Expected status code 403, got { data_2 .status_code } "
257256
@@ -262,17 +261,19 @@ def test_drs_no_parameters(client, user, mock_arborist_requests, is_rbac_configu
262261 }
263262 )
264263
265- print ("DEBUG >>>>>> User should not have access to any records " , file = sys .stderr )
264+ print ("DEBUG >>>>>> User should not have access to any /ga4gh/drs/v1/objects " , file = sys .stderr )
266265 data_all_by_md = client .get ("/ga4gh/drs/v1/objects" , headers = user )
267266 assert data_all_by_md .status_code == 200 , f"Expected status code 200, got { data_all_by_md .status_code } "
268267 data_all_list = data_all_by_md .json
269268
270269 assert len (data_all_list [
271270 "drs_objects" ]) == 0 , f"Should have access to 0 records, got { len (data_all_list ['drs_objects' ])} records: { data_all_list } "
272271
272+ print (f"DEBUG >>>>>> User should not have access to /ga4gh/drs/v1/objects/{ res1_did } " , file = sys .stderr )
273273 data_1 = client .get (f"/ga4gh/drs/v1/objects/{ res1_did } " , headers = user )
274274 assert data_1 .status_code == 401 , f"Expected status code 401, got { data_1 .status_code } "
275275
276+ print (f"DEBUG >>>>>> User should not have access to /ga4gh/drs/v1/objects/{ res2_did } " , file = sys .stderr )
276277 data_2 = client .get (f"/ga4gh/drs/v1/objects/{ res2_did } " , headers = user )
277278 assert data_2 .status_code == 401 , f"Expected status code 401, got { data_2 .status_code } "
278279
@@ -282,7 +283,7 @@ def test_drs_no_parameters(client, user, mock_arborist_requests, is_rbac_configu
282283 }
283284 )
284285
285- print ("DEBUG >>>>>> User should not have access to anything " , file = sys .stderr )
286+ print ("DEBUG >>>>>> User should not have access to /ga4gh/drs/v1/objects " , file = sys .stderr )
286287 data_all_by_md = client .get ("/ga4gh/drs/v1/objects" , headers = user )
287288 assert data_all_by_md .status_code == 200 , f"Expected status code 200, got { data_all_by_md .status_code } "
288289 data_all_list = data_all_by_md .json
0 commit comments