tests/conftest.py
1.3 KB · 53 lines · python Raw
1 """Shared pytest fixtures for PQC MCP Transport tests."""
2
3 from __future__ import annotations
4
5 import pytest
6 from quantumshield.identity.agent import AgentIdentity
7
8 from pqc_mcp_transport.signer import MessageSigner
9
10
11 @pytest.fixture
12 def client_identity() -> AgentIdentity:
13 """An AgentIdentity representing a client."""
14 return AgentIdentity.create("test-client", capabilities=["tools:call"])
15
16
17 @pytest.fixture
18 def server_identity() -> AgentIdentity:
19 """An AgentIdentity representing a server."""
20 return AgentIdentity.create("test-server", capabilities=["tools:serve"])
21
22
23 @pytest.fixture
24 def message_signer(client_identity: AgentIdentity) -> MessageSigner:
25 """A MessageSigner backed by the client identity."""
26 return MessageSigner(client_identity)
27
28
29 @pytest.fixture
30 def sample_tool_call() -> dict:
31 """A sample JSON-RPC tool call message."""
32 return {
33 "jsonrpc": "2.0",
34 "method": "tools/call",
35 "id": "abc123",
36 "params": {
37 "name": "greet",
38 "arguments": {"name": "World"},
39 },
40 }
41
42
43 @pytest.fixture
44 def sample_response() -> dict:
45 """A sample JSON-RPC response message."""
46 return {
47 "jsonrpc": "2.0",
48 "id": "abc123",
49 "result": {
50 "content": "Hello, World!",
51 },
52 }
53