test: update testing - having removed the router client init logic

this allows a user to just set the credential value in litellm params, and not have to worry about settin
g credentials
This commit is contained in:
Krrish Dholakia 2025-03-10 20:02:33 -07:00
parent f56c5ca380
commit ae021671a8
2 changed files with 19 additions and 31 deletions

View file

@ -182,25 +182,25 @@ def test_router_init_azure_service_principal_with_secret_with_environment_variab
# initialize the router
router = Router(model_list=model_list)
# first check if environment variables were used at all
mocked_environ.assert_called()
# then check if the client was initialized with the correct environment variables
mocked_credential.assert_called_with(
**{
"client_id": environment_variables_expected_to_use["AZURE_CLIENT_ID"],
"client_secret": environment_variables_expected_to_use[
"AZURE_CLIENT_SECRET"
],
"tenant_id": environment_variables_expected_to_use["AZURE_TENANT_ID"],
}
)
# check if the token provider was called at all
mocked_get_bearer_token_provider.assert_called()
# then check if the token provider was initialized with the mocked credential
for call_args in mocked_get_bearer_token_provider.call_args_list:
assert call_args.args[0] == mocked_credential.return_value
# however, at this point token should not be fetched yet
mocked_func_generating_token.assert_not_called()
# # first check if environment variables were used at all
# mocked_environ.assert_called()
# # then check if the client was initialized with the correct environment variables
# mocked_credential.assert_called_with(
# **{
# "client_id": environment_variables_expected_to_use["AZURE_CLIENT_ID"],
# "client_secret": environment_variables_expected_to_use[
# "AZURE_CLIENT_SECRET"
# ],
# "tenant_id": environment_variables_expected_to_use["AZURE_TENANT_ID"],
# }
# )
# # check if the token provider was called at all
# mocked_get_bearer_token_provider.assert_called()
# # then check if the token provider was initialized with the mocked credential
# for call_args in mocked_get_bearer_token_provider.call_args_list:
# assert call_args.args[0] == mocked_credential.return_value
# # however, at this point token should not be fetched yet
# mocked_func_generating_token.assert_not_called()
# now let's try to make a completion call
deployment = model_list[0]