Skip to content

Commit 8eea975

Browse files
authored
Merge pull request #66 from keycardai/larry/test-docs
docs(mcp): add test infrastructure documentation
2 parents 3b5ddf4 + 295f7bd commit 8eea975

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

packages/mcp/tests/README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Test Infrastructure
2+
3+
## Running Tests
4+
5+
### Default Tests (Mocked)
6+
7+
Run all tests without any environment variables:
8+
9+
```bash
10+
uv run pytest packages/mcp/tests -v
11+
```
12+
13+
These tests use mock fixtures and don't require real Keycard infrastructure.
14+
15+
### Interactive Tests (Real Infrastructure)
16+
17+
Tests in `integration/interactive/` require a real Keycard zone:
18+
19+
```bash
20+
export KEYCARD_ZONE_URL="https://your-zone.keycard.cloud"
21+
export OPENAI_API_KEY="sk-..." # Optional, for agent tests
22+
export RUN_INTERACTIVE_TESTS=1
23+
24+
uv run pytest packages/mcp/tests/integration/interactive/ -v -s
25+
```
26+
27+
## Test Organization
28+
29+
| Directory | Purpose | Infrastructure |
30+
|-----------|---------|----------------|
31+
| `keycardai/` | Unit tests | Mocked |
32+
| `integration/e2e/` | End-to-end flows | Mocked |
33+
| `integration/interactive/` | Manual OAuth flows | Real Keycard |
34+
35+
## Environment Variables
36+
37+
| Variable | Required For | Description |
38+
|----------|--------------|-------------|
39+
| `RUN_INTERACTIVE_TESTS` | Interactive tests | Set to `1` to enable |
40+
| `KEYCARD_ZONE_URL` | Interactive tests | Real Keycard zone URL |
41+
| `OPENAI_API_KEY` | Agent integration tests | OpenAI API key |
42+
| `MCP_TEST_PORT` | Interactive tests | Custom port (default: 8765) |
43+
44+
## Mocking Patterns
45+
46+
Tests use dependency injection of mock clients via `client_factory` parameter.
47+
See `fixtures/auth_provider.py` for reusable mock fixtures.

0 commit comments

Comments
 (0)