mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-11 22:51:28 +00:00
Fix : test_exception_without_scanners
This commit is contained in:
parent
7a35116148
commit
8374b4d939
1 changed files with 39 additions and 39 deletions
|
|
@ -1272,20 +1272,20 @@ async def test_exception_without_scanners(
|
|||
pillar_flagged_response,
|
||||
):
|
||||
"""Test exception excludes scanners when include_scanners is False."""
|
||||
guardrail = PillarGuardrail(
|
||||
guardrail_name="pillar-no-scanners",
|
||||
api_key="test-pillar-key",
|
||||
api_base="https://api.pillar.security",
|
||||
on_flagged_action="block",
|
||||
include_scanners=False,
|
||||
include_evidence=True,
|
||||
)
|
||||
with patch(
|
||||
"litellm.llms.custom_httpx.http_handler.AsyncHTTPHandler.post",
|
||||
return_value=pillar_flagged_response,
|
||||
):
|
||||
guardrail = PillarGuardrail(
|
||||
guardrail_name="pillar-no-scanners",
|
||||
api_key="test-pillar-key",
|
||||
api_base="https://api.pillar.security",
|
||||
on_flagged_action="block",
|
||||
include_scanners=False,
|
||||
include_evidence=True,
|
||||
)
|
||||
|
||||
with pytest.raises(HTTPException) as excinfo:
|
||||
with patch(
|
||||
"litellm.llms.custom_httpx.http_handler.AsyncHTTPHandler.post",
|
||||
return_value=pillar_flagged_response,
|
||||
):
|
||||
with pytest.raises(HTTPException) as excinfo:
|
||||
await guardrail.async_pre_call_hook(
|
||||
data=sample_request_data,
|
||||
cache=dual_cache,
|
||||
|
|
@ -1307,20 +1307,20 @@ async def test_exception_without_evidence(
|
|||
pillar_flagged_response,
|
||||
):
|
||||
"""Test exception excludes evidence when include_evidence is False."""
|
||||
guardrail = PillarGuardrail(
|
||||
guardrail_name="pillar-no-evidence",
|
||||
api_key="test-pillar-key",
|
||||
api_base="https://api.pillar.security",
|
||||
on_flagged_action="block",
|
||||
include_scanners=True,
|
||||
include_evidence=False,
|
||||
)
|
||||
with patch(
|
||||
"litellm.llms.custom_httpx.http_handler.AsyncHTTPHandler.post",
|
||||
return_value=pillar_flagged_response,
|
||||
):
|
||||
guardrail = PillarGuardrail(
|
||||
guardrail_name="pillar-no-evidence",
|
||||
api_key="test-pillar-key",
|
||||
api_base="https://api.pillar.security",
|
||||
on_flagged_action="block",
|
||||
include_scanners=True,
|
||||
include_evidence=False,
|
||||
)
|
||||
|
||||
with pytest.raises(HTTPException) as excinfo:
|
||||
with patch(
|
||||
"litellm.llms.custom_httpx.http_handler.AsyncHTTPHandler.post",
|
||||
return_value=pillar_flagged_response,
|
||||
):
|
||||
with pytest.raises(HTTPException) as excinfo:
|
||||
await guardrail.async_pre_call_hook(
|
||||
data=sample_request_data,
|
||||
cache=dual_cache,
|
||||
|
|
@ -1342,20 +1342,20 @@ async def test_exception_without_scanners_or_evidence(
|
|||
pillar_flagged_response,
|
||||
):
|
||||
"""Test exception excludes both scanners and evidence when both are False."""
|
||||
guardrail = PillarGuardrail(
|
||||
guardrail_name="pillar-minimal",
|
||||
api_key="test-pillar-key",
|
||||
api_base="https://api.pillar.security",
|
||||
on_flagged_action="block",
|
||||
include_scanners=False,
|
||||
include_evidence=False,
|
||||
)
|
||||
with patch(
|
||||
"litellm.llms.custom_httpx.http_handler.AsyncHTTPHandler.post",
|
||||
return_value=pillar_flagged_response,
|
||||
):
|
||||
guardrail = PillarGuardrail(
|
||||
guardrail_name="pillar-minimal",
|
||||
api_key="test-pillar-key",
|
||||
api_base="https://api.pillar.security",
|
||||
on_flagged_action="block",
|
||||
include_scanners=False,
|
||||
include_evidence=False,
|
||||
)
|
||||
|
||||
with pytest.raises(HTTPException) as excinfo:
|
||||
with patch(
|
||||
"litellm.llms.custom_httpx.http_handler.AsyncHTTPHandler.post",
|
||||
return_value=pillar_flagged_response,
|
||||
):
|
||||
with pytest.raises(HTTPException) as excinfo:
|
||||
await guardrail.async_pre_call_hook(
|
||||
data=sample_request_data,
|
||||
cache=dual_cache,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue