Skip to content

Commit 9577886

Browse files
committed
refactor: replace integration tests with unit tests using mocked callProvider
Consolidate 24 per-provider integration test files into parameterized unit tests that mock callProvider, eliminating all production API dependencies. Tests run instantly with deterministic results. TypeScript: 131 tests across 10 files (was 27 files) Python: 86 tests across 7 files (was 12 files) Made-with: Cursor
1 parent bf4a6ed commit 9577886

36 files changed

+1632
-4384
lines changed

sdk/python/tests/conftest.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,12 @@
22
pytest configuration and fixtures
33
"""
44

5-
import os
6-
from pathlib import Path
7-
85
import pytest
9-
from dotenv import load_dotenv
106

11-
# Load environment variables from root .env file
12-
env_path = Path(__file__).parent.parent.parent.parent / ".env"
13-
load_dotenv(env_path)
7+
from safety_agent import create_client
148

159

1610
@pytest.fixture
1711
def client():
18-
"""Create a Safety Agent client for testing."""
19-
from safety_agent import create_client
20-
21-
return create_client()
12+
"""Create a Safety Agent client for testing with a fake API key."""
13+
return create_client(api_key="test-key")

sdk/python/tests/test_anthropic_guard.py

Lines changed: 0 additions & 77 deletions
This file was deleted.

sdk/python/tests/test_anthropic_redact.py

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)