Skip to content

Commit 645981b

Browse files
committed
test: add mock downstream email adapter
1 parent e4906f6 commit 645981b

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
"""
2+
Mock downstream email adapter for ESP-001.
3+
4+
This adapter is intentionally synthetic and in-memory.
5+
It proves whether the send connector would be called inside the test harness.
6+
It does not prove live SMTP/API non-execution.
7+
"""
8+
9+
from __future__ import annotations
10+
11+
from dataclasses import dataclass, field
12+
from typing import Any, Dict, List
13+
14+
15+
@dataclass
16+
class MockEmailAdapter:
17+
"""In-memory stand-in for an external email connector."""
18+
19+
sent_messages: List[Dict[str, Any]] = field(default_factory=list)
20+
21+
def send(self, *, recipient: str, payload_hash: str, actor: str) -> Dict[str, Any]:
22+
event = {
23+
"recipient": recipient,
24+
"payload_hash": payload_hash,
25+
"actor": actor,
26+
"dispatched": True,
27+
}
28+
self.sent_messages.append(event)
29+
return event
30+
31+
@property
32+
def send_call_count(self) -> int:
33+
return len(self.sent_messages)

0 commit comments

Comments
 (0)