-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathconftest.py
More file actions
28 lines (21 loc) · 778 Bytes
/
conftest.py
File metadata and controls
28 lines (21 loc) · 778 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from unittest.mock import patch
import pytest
from uipath.core.guardrails import GuardrailValidationResult
@pytest.fixture
def mock_env_vars():
return {
"UIPATH_URL": "http://example.com",
"UIPATH_ACCESS_TOKEN": "***",
"UIPATH_TENANT_ID": "test-tenant-id",
}
@pytest.fixture
def mock_guardrails_service():
"""Mock the guardrails service to avoid HTTP errors in tests."""
def mock_evaluate_guardrail(text, guardrail):
"""Mock guardrail evaluation - always passes validation."""
return GuardrailValidationResult(validation_passed=True, reason="")
with patch(
"uipath.platform.guardrails.GuardrailsService.evaluate_guardrail",
side_effect=mock_evaluate_guardrail,
) as mock:
yield mock