tests/conftest.py
1.6 KB · 71 lines · python Raw
1 """Pytest fixtures for pqc-rag-signing tests."""
2
3 from __future__ import annotations
4
5 import pytest
6 from quantumshield.identity.agent import AgentIdentity
7
8 from pqc_rag_signing import (
9 ChunkMetadata,
10 ChunkSigner,
11 RAGAuditLog,
12 SignedChunk,
13 )
14
15
16 @pytest.fixture
17 def ingest_identity() -> AgentIdentity:
18 return AgentIdentity.create("test-ingest-pipeline")
19
20
21 @pytest.fixture
22 def attacker_identity() -> AgentIdentity:
23 return AgentIdentity.create("evil-attacker")
24
25
26 @pytest.fixture
27 def signer(ingest_identity: AgentIdentity) -> ChunkSigner:
28 return ChunkSigner(ingest_identity, corpus_id="test-corpus")
29
30
31 @pytest.fixture
32 def sample_metadata() -> ChunkMetadata:
33 return ChunkMetadata(
34 source="test-document.txt",
35 chunk_index=0,
36 total_chunks=3,
37 start_offset=0,
38 end_offset=42,
39 )
40
41
42 @pytest.fixture
43 def sample_signed_chunk(
44 signer: ChunkSigner,
45 sample_metadata: ChunkMetadata,
46 ) -> SignedChunk:
47 return signer.sign_chunk(
48 "The quick brown fox jumps over the lazy dog.",
49 sample_metadata,
50 )
51
52
53 @pytest.fixture
54 def sample_corpus_texts() -> dict[str, list[str]]:
55 return {
56 "handbook.txt": [
57 "Employees must follow the PQC security policy.",
58 "All data in transit uses ML-KEM key exchange.",
59 "Model weights are signed with ML-DSA-87.",
60 ],
61 "policies.txt": [
62 "Incident response requires quantum-safe attestation.",
63 "Audit logs are append-only and hash-chained.",
64 ],
65 }
66
67
68 @pytest.fixture
69 def audit_log() -> RAGAuditLog:
70 return RAGAuditLog()
71