mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-04 02:31:27 +00:00
test: add unit tests for get_standard_logging_metadata non-string user_api_key handling
This commit is contained in:
parent
fc3aad8850
commit
7a90b94ff9
1 changed files with 16 additions and 0 deletions
|
|
@ -219,6 +219,22 @@ def test_get_standard_logging_metadata_invalid_user_api_key():
|
|||
assert result["user_api_key_hash"] is None
|
||||
|
||||
|
||||
def test_get_standard_logging_metadata_non_string_user_api_key():
|
||||
"""Non-string user_api_key should not be set as user_api_key_hash."""
|
||||
metadata = {"user_api_key": 12345}
|
||||
result = StandardLoggingPayloadSetup.get_standard_logging_metadata(metadata)
|
||||
all_fields_present(result)
|
||||
assert result["user_api_key_hash"] is None
|
||||
|
||||
|
||||
def test_get_standard_logging_metadata_none_user_api_key():
|
||||
"""None user_api_key should not be set as user_api_key_hash."""
|
||||
metadata = {"user_api_key": None}
|
||||
result = StandardLoggingPayloadSetup.get_standard_logging_metadata(metadata)
|
||||
all_fields_present(result)
|
||||
assert result["user_api_key_hash"] is None
|
||||
|
||||
|
||||
def test_get_standard_logging_metadata_invalid_keys():
|
||||
metadata = {
|
||||
"user_api_key_alias": "test_alias",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue