mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-29 06:33:28 +00:00
Merge c5c7aaa0c1 into 230f653523
This commit is contained in:
commit
aa98a15de0
2 changed files with 10 additions and 1 deletions
|
|
@ -789,7 +789,7 @@ def _update_metadata_field(updated_kv: dict, field_name: str) -> None:
|
|||
# only for a truthy value. The falsy value is still persisted below so a
|
||||
# previously-set field can be cleared.
|
||||
if updated_kv.get(field_name):
|
||||
premium_user_check()
|
||||
premium_user_check(field_name)
|
||||
|
||||
if field_name in updated_kv and updated_kv[field_name] is not None:
|
||||
# remove field from updated_kv
|
||||
|
|
|
|||
|
|
@ -1307,6 +1307,15 @@ class TestSetObjectMetadataFieldPremiumArg:
|
|||
mock_premium.assert_called_once_with("guardrails")
|
||||
|
||||
|
||||
class TestUpdateMetadataFieldLicenseError:
|
||||
def test_license_error_names_the_blocking_field(self):
|
||||
with patch("litellm.proxy.proxy_server.premium_user", False):
|
||||
with pytest.raises(HTTPException) as exc_info:
|
||||
update_metadata_fields({"team_id": "t1", "guardrails": ["g1"]})
|
||||
assert exc_info.value.status_code == 403
|
||||
assert "guardrails" in exc_info.value.detail["error"]
|
||||
|
||||
|
||||
class TestUpdateMetadataFieldMove:
|
||||
def test_none_valued_field_is_not_moved_into_metadata(self):
|
||||
"""A None value must leave the field untouched (guard requires non-None)."""
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue