mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-05 02:41:56 +00:00
test(proxy): cover Microsoft SSO pagination limit
This commit is contained in:
parent
e9858c29b8
commit
527c927b15
1 changed files with 26 additions and 0 deletions
|
|
@ -477,6 +477,11 @@ async def test_get_group_ids_from_service_principal_follows_next_link():
|
|||
"principalId": "user-1",
|
||||
"principalDisplayName": "User 1",
|
||||
},
|
||||
{
|
||||
"principalType": "Group",
|
||||
"principalId": None,
|
||||
"principalDisplayName": "Invalid Group",
|
||||
},
|
||||
],
|
||||
"@odata.nextLink": next_link,
|
||||
}
|
||||
|
|
@ -516,6 +521,27 @@ async def test_get_group_ids_from_service_principal_follows_next_link():
|
|||
]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_get_group_ids_from_service_principal_stops_at_page_limit():
|
||||
response = MagicMock()
|
||||
response.json.return_value = {
|
||||
"value": [],
|
||||
"@odata.nextLink": "https://graph.microsoft.com/v1.0/next-page",
|
||||
}
|
||||
async_client = MagicMock()
|
||||
async_client.get = AsyncMock(return_value=response)
|
||||
|
||||
group_ids, teams = await MicrosoftSSOHandler.get_group_ids_from_service_principal(
|
||||
service_principal_id="sp-123",
|
||||
async_client=async_client,
|
||||
access_token="mock_token",
|
||||
)
|
||||
|
||||
assert group_ids == []
|
||||
assert teams == []
|
||||
assert async_client.get.await_count == MicrosoftSSOHandler.MAX_GRAPH_API_PAGES
|
||||
|
||||
|
||||
def test_get_group_ids_from_graph_api_response():
|
||||
# Arrange
|
||||
mock_response = MicrosoftGraphAPIUserGroupResponse(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue