@@ -14,8 +14,8 @@ def get_create_service_account_url(team_name: str) -> str:
1414 return f"/api/cyberstorm/team/{ team_name } /service-account/create/"
1515
1616
17- def get_delete_service_account_url (team_name : str , uuid : str ) -> str :
18- return f"/api/cyberstorm/team/ { team_name } / service-account/delete/ { uuid } /"
17+ def get_delete_service_account_url (uuid : str ) -> str :
18+ return f"/api/cyberstorm/service-account/{ uuid } /delete /"
1919
2020
2121@pytest .mark .django_db
@@ -140,7 +140,7 @@ def test_delete_service_account_success(
140140 assert ServiceAccount .objects .filter (uuid = service_account .uuid ).count () == 1
141141
142142 api_client .force_authenticate (team_owner .user )
143- url = get_delete_service_account_url (team_owner . team . name , service_account .uuid )
143+ url = get_delete_service_account_url (service_account .uuid )
144144 response = api_client .delete (path = url , content_type = "application/json" )
145145
146146 assert response .status_code == 204
@@ -155,7 +155,7 @@ def test_delete_service_account_fail_user_is_not_authenticated(
155155):
156156 assert ServiceAccount .objects .filter (uuid = service_account .uuid ).count () == 1
157157
158- url = get_delete_service_account_url (team . name , service_account .uuid )
158+ url = get_delete_service_account_url (service_account .uuid )
159159 response = api_client .delete (path = url , content_type = "application/json" )
160160 expected_response = {"detail" : "Authentication credentials were not provided." }
161161
@@ -175,7 +175,7 @@ def test_delete_service_account_fails_because_user_is_not_team_member(
175175 non_team_user = User .objects .create ()
176176 api_client .force_authenticate (non_team_user )
177177
178- url = get_delete_service_account_url (team . name , service_account .uuid )
178+ url = get_delete_service_account_url (service_account .uuid )
179179 response = api_client .delete (path = url , content_type = "application/json" )
180180 expected_response = {"non_field_errors" : ["Must be a member to access team" ]}
181181
@@ -194,7 +194,7 @@ def test_delete_service_account_fail_because_user_is_not_team_owner(
194194 assert ServiceAccount .objects .filter (uuid = service_account .uuid ).count () == 1
195195
196196 api_client .force_authenticate (team_member .user )
197- url = get_delete_service_account_url (team . name , service_account .uuid )
197+ url = get_delete_service_account_url (service_account .uuid )
198198 response = api_client .delete (path = url , content_type = "application/json" )
199199 expected_response = {
200200 "non_field_errors" : ["Must be an owner to delete a service account" ]
0 commit comments