Add a testcase
This commit is contained in:
parent
edf047b6bb
commit
ffbe5cd899
27
tests/test_litellm/proxy/common_utils/test_callback_utils.py
Normal file
27
tests/test_litellm/proxy/common_utils/test_callback_utils.py
Normal file
@ -0,0 +1,27 @@
|
||||
import sys
|
||||
import os
|
||||
|
||||
sys.path.insert(
|
||||
0, os.path.abspath("../../..")
|
||||
) # Adds the parent directory to the system path
|
||||
|
||||
from litellm.proxy.common_utils.callback_utils import get_remaining_tokens_and_requests_from_request_data
|
||||
|
||||
def test_get_remaining_tokens_and_requests_from_request_data():
|
||||
model_group = "openrouter/google/gemini-2.0-flash-001"
|
||||
casedata = {
|
||||
"metadata": {
|
||||
"model_group": model_group,
|
||||
f"litellm-key-remaining-requests-{model_group}": 100,
|
||||
f"litellm-key-remaining-tokens-{model_group}": 200
|
||||
}
|
||||
}
|
||||
|
||||
headers = get_remaining_tokens_and_requests_from_request_data(casedata)
|
||||
|
||||
expected_name = "openrouter-google-gemini-2.0-flash-001"
|
||||
assert headers == {
|
||||
f"x-litellm-key-remaining-requests-{expected_name}": 100,
|
||||
f"x-litellm-key-remaining-tokens-{expected_name}": 200
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user