@@ -184,3 +184,27 @@ def test_unassign_endpoint(rando, org_inv_rd, inventory, admin_api_client):
184184    response  =  admin_api_client .post (url , data )
185185    assert  response .status_code  ==  200 , response .data 
186186    assert  not  rando .has_obj_perm (inventory , 'change' )
187+ 
188+ 
189+ @pytest .mark .django_db  
190+ @pytest .mark .parametrize ( 
191+     'reverse_name,normal_case,unauth_case' , 
192+     [ 
193+         ('dabcontenttype-list' , 200 , 401 ),  # could change unauthenticated case, depends on need  
194+         ('dabpermission-list' , 200 , 401 ), 
195+         ('resource-list' , 403 , 401 ), 
196+         ('serviceuserassignment-list' , 403 , 401 ), 
197+         ('serviceteamassignment-list' , 403 , 401 ) 
198+     ] 
199+ ) 
200+ def  test_service_api_permissions (reverse_name , normal_case , unauth_case , admin_api_client , user_api_client , unauthenticated_api_client ):
201+     url  =  get_relative_url (reverse_name )
202+ 
203+     admin_response  =  admin_api_client .get (url )
204+     assert  admin_response .status_code  ==  200 , admin_response .data 
205+ 
206+     normal_response  =  user_api_client .get (url )
207+     assert  normal_response .status_code  ==  normal_case , normal_response .data 
208+ 
209+     unauth_response  =  unauthenticated_api_client .get (url )
210+     assert  unauth_response .status_code  ==  unauth_case , unauth_response .data 
0 commit comments