@@ -235,7 +235,7 @@ def test_create_private_ai_key_without_owner_or_team(mock_post, client, admin_to
235
235
236
236
@patch ("app.services.litellm.requests.post" )
237
237
def test_create_team_private_ai_key_as_key_creator (mock_post , client , team_key_creator_token , test_team_id , test_region , mock_litellm_response ):
238
- """Test that a team member with key_creator role cannot create a team key"""
238
+ """Test that a team member with key_creator role can create a team key"""
239
239
# Mock the LiteLLM API response (though it shouldn't be called)
240
240
mock_post .return_value .status_code = 200
241
241
mock_post .return_value .json .return_value = mock_litellm_response
@@ -252,10 +252,12 @@ def test_create_team_private_ai_key_as_key_creator(mock_post, client, team_key_c
252
252
}
253
253
)
254
254
255
- assert response .status_code == 403
256
- assert "Not authorized to perform this action" in response .json ()["detail" ]
257
- # Verify that the LiteLLM API was not called
258
- mock_post .assert_not_called ()
255
+ assert response .status_code == 200
256
+ data = response .json ()
257
+ assert data ["region" ] == test_region .name
258
+ assert data ["litellm_token" ] == "test-private-key-123"
259
+ assert data ["team_id" ] == test_team_id
260
+ assert data ["owner_id" ] is None
259
261
260
262
@patch ("app.services.litellm.requests.post" )
261
263
def test_create_private_ai_key_with_both_owner_and_team (mock_post , client , admin_token , test_team , test_team_user , test_region , mock_litellm_response ):
0 commit comments