Skip to content

Commit 0156a71

Browse files
committed
fix: update test in line with changes
1 parent 299ac98 commit 0156a71

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

tests/test_private_ai.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ def test_create_private_ai_key_without_owner_or_team(mock_post, client, admin_to
235235

236236
@patch("app.services.litellm.requests.post")
237237
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"""
239239
# Mock the LiteLLM API response (though it shouldn't be called)
240240
mock_post.return_value.status_code = 200
241241
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
252252
}
253253
)
254254

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
259261

260262
@patch("app.services.litellm.requests.post")
261263
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

Comments
 (0)