Fullstack Test Reference
This document provides a complete catalog of all 120 fullstack integration tests, organized by group and test class.
00_core - Core Functionality
22 tests validating basic API functionality, authentication, and infrastructure.
TestHealthAndBasics
File: tests/fullstack/00_core/test_00_health.py
Health endpoint and API authentication tests.
Test |
Description |
|---|---|
|
GET /health works without authentication |
|
GET /status requires API token |
|
GET /status returns status with valid token |
|
Invalid API token returns 403 |
Docker Integration Tests
File: tests/fullstack/00_core/test_05_docker_integration.py
Tests verifying Docker infrastructure and basic email flow.
Test |
Description |
|---|---|
|
All Docker services are running and healthy |
|
Email sent via API arrives at Tenant 1 MailHog |
|
Email sent via API arrives at Tenant 2 MailHog |
|
Tenant 1 emails don’t appear in Tenant 2 MailHog |
|
Multiple emails to same tenant all arrive |
|
HTML email content preserved through system |
|
Custom headers preserved in sent email |
TestInfrastructureCheck
File: tests/fullstack/00_core/test_10_infrastructure.py
Infrastructure connectivity verification.
Test |
Description |
|---|---|
|
PostgreSQL database is accessible |
|
MailHog Tenant 1 API responds |
|
MailHog Tenant 2 API responds |
|
MinIO S3 API responds |
|
Client echo servers respond |
TestTenantManagement
File: tests/fullstack/00_core/test_20_tenants.py
Tenant CRUD operations.
Test |
Description |
|---|---|
|
POST /tenant creates new tenant |
|
GET /tenants returns tenant list |
|
GET /tenant?id=X returns tenant details |
|
PUT /tenant updates tenant configuration |
TestAccountManagement
File: tests/fullstack/00_core/test_30_accounts.py
SMTP account management.
Test |
Description |
|---|---|
|
GET /accounts returns account list |
|
POST /account with rate limit fields |
10_messaging - Message Handling
16 tests covering message validation, dispatch, and batch operations.
TestValidation
File: tests/fullstack/10_messaging/test_00_validation.py
Input validation tests.
Test |
Description |
|---|---|
|
Message without required fields rejected |
|
Message with non-existent account rejected |
TestBasicMessageDispatch
File: tests/fullstack/10_messaging/test_10_dispatch.py
Basic email dispatch tests.
Test |
Description |
|---|---|
|
Plain text email sent and received |
|
HTML email content preserved |
|
CC and BCC recipients receive email |
|
Custom headers included in sent email |
TestMessageManagement
File: tests/fullstack/10_messaging/test_20_messages.py
Message API operations.
Test |
Description |
|---|---|
|
GET /messages returns message list |
|
DELETE /messages removes messages |
TestBatchOperations
File: tests/fullstack/10_messaging/test_30_batch.py
Batch message operations.
Test |
Description |
|---|---|
|
Multiple messages enqueued in single request |
|
Duplicate message IDs rejected |
TestBatchCodeOperations
File: tests/fullstack/10_messaging/test_30_batch.py
Batch code grouping and control.
Test |
Description |
|---|---|
|
Messages with batch_code stored correctly |
|
Suspend only affects specific batch_code |
|
Activate resumes specific batch_code |
|
Other batches unaffected by suspend |
|
Suspended batch messages remain pending |
TestPriorityHandling
File: tests/fullstack/10_messaging/test_40_priority.py
Priority queue tests.
Test |
Description |
|---|---|
|
Higher priority messages sent first |
20_attachments - Attachment Handling
18 tests covering base64, HTTP, S3 attachments, and unicode encoding.
TestAttachmentsBase64
File: tests/fullstack/20_attachments/test_00_attachments.py
Base64 inline attachment tests.
Test |
Description |
|---|---|
|
Base64-encoded attachment sent correctly |
TestHttpAttachmentFetch
File: tests/fullstack/20_attachments/test_00_attachments.py
HTTP URL attachment fetching.
Test |
Description |
|---|---|
|
Single HTTP URL attachment fetched |
|
Multiple HTTP URLs fetched in parallel |
|
Timeout handled gracefully |
|
Invalid URL handled gracefully |
TestLargeFileStorage
File: tests/fullstack/20_attachments/test_10_large_files.py
S3 large file storage tests.
Test |
Description |
|---|---|
|
Small attachment sent inline |
|
Large attachment uploaded to S3, link in email |
|
action=reject returns error for large files |
|
action=warn sends with warning |
|
Mix of small/large attachments handled |
|
File actually exists in MinIO bucket |
TestTenantLargeFileConfigApi
File: tests/fullstack/20_attachments/test_10_large_files.py
Large file configuration API.
Test |
Description |
|---|---|
|
Tenant created with S3 config |
|
S3 config updated via API |
|
S3 config can be disabled |
TestUnicodeEncoding
File: tests/fullstack/20_attachments/test_20_unicode.py
Unicode and international character tests.
Test |
Description |
|---|---|
|
Emoji preserved in subject line |
|
Emoji preserved in message body |
|
CJK, Arabic, Cyrillic characters preserved |
|
Unicode filenames handled correctly |
30_delivery - Delivery Handling
9 tests covering SMTP error handling and delivery reports.
TestSmtpErrorHandling
File: tests/fullstack/30_delivery/test_00_smtp_errors.py
SMTP error simulation tests.
Test |
Description |
|---|---|
|
550 error marks message as error |
|
451 error defers message for retry |
|
452 rate limit defers excess messages |
|
Random SMTP behavior produces mixed results |
TestRetryLogic
File: tests/fullstack/30_delivery/test_00_smtp_errors.py
Retry mechanism tests.
Test |
Description |
|---|---|
|
retry_count increases on each attempt |
|
Error field contains SMTP error details |
TestDeliveryReports
File: tests/fullstack/30_delivery/test_10_delivery_reports.py
Delivery report callback tests.
Test |
Description |
|---|---|
|
Success report sent to client endpoint |
|
Error report sent to client endpoint |
|
Report includes both success and error |
40_operations - Operations
21 tests covering metrics, service control, rate limiting, and retention.
TestMetrics
File: tests/fullstack/40_operations/test_00_metrics.py
Prometheus metrics tests.
Test |
Description |
|---|---|
|
GET /metrics returns Prometheus format |
TestServiceControl
File: tests/fullstack/40_operations/test_10_service_control.py
Suspend/activate functionality.
Test |
Description |
|---|---|
|
Basic suspend/activate cycle works |
|
Suspend specific batch_code only |
|
Suspend without tenant_id rejected |
TestExtendedSuspendActivate
File: tests/fullstack/40_operations/test_10_service_control.py
Extended suspend/activate tests.
Test |
Description |
|---|---|
|
Suspend returns count of affected messages |
|
Activate returns count of resumed messages |
|
Multiple suspends are idempotent |
|
Multiple activates are idempotent |
|
Suspend doesn’t affect other tenants |
|
Deferred messages handled in suspend |
|
Activate preserves deferred timing |
TestAccountRateLimiting
File: tests/fullstack/40_operations/test_20_rate_limiting.py
Marker: rate_limit
Account-level rate limiting tests.
Test |
Description |
|---|---|
|
Messages over limit_per_minute are deferred |
|
Per-hour rate limit configuration accepted |
|
limit_behavior=reject rejects excess messages |
|
Rate limit counter resets after window |
|
Each account has independent rate limits |
TestRetentionCleanup
File: tests/fullstack/40_operations/test_30_retention.py
Marker: retention
Data retention tests.
Test |
Description |
|---|---|
|
Old reported messages cleaned up |
|
Cleanup only affects specified tenant |
|
Messages without reported_ts preserved |
|
Bounced but unreported messages preserved |
|
Retention period configurable per tenant |
50_security - Security
15 tests covering tenant isolation, input sanitization, and authentication.
TestTenantIsolation
File: tests/fullstack/50_security/test_00_isolation.py
Tenant isolation tests.
Test |
Description |
|---|---|
|
Each tenant’s messages go to correct SMTP |
|
run-now triggers dispatch for specified tenant |
TestSecurityInputSanitization
File: tests/fullstack/50_security/test_10_security.py
Input sanitization tests.
Test |
Description |
|---|---|
|
SQL injection in tenant_id handled safely |
|
SQL injection in message_id handled safely |
|
XSS in subject stored literally, not executed |
|
Path traversal attempts handled safely |
|
Large payloads don’t crash server |
TestPerTenantApiKeys
File: tests/fullstack/50_security/test_20_tenant_auth.py
Per-tenant API key authentication.
Test |
Description |
|---|---|
|
Tenant token accesses own resources |
|
Tenant token rejected for other tenant |
|
Global token works for all tenants |
|
Invalid token returns 403 |
|
Missing token returns 401 |
|
Token can be rotated |
|
Revoked token rejected |
|
Tenant token limited to own operations |
60_imap - Bounce Detection
19 tests covering bounce parsing, headers, and live IMAP polling.
TestBounceDetection
File: tests/fullstack/60_imap/test_00_bounce.py
Bounce header and field tests.
Test |
Description |
|---|---|
|
X-Genro-Mail-ID header added to outgoing email |
|
Bounce fields present in /messages response |
|
MessageRecord has bounce_type, bounce_code, etc. |
|
Each message gets unique X-Genro-Mail-ID |
|
X-Genro-Mail-ID coexists with custom headers |
TestBounceEndToEnd
File: tests/fullstack/60_imap/test_00_bounce.py
Marker: bounce_e2e
End-to-end bounce detection tests.
Test |
Description |
|---|---|
|
Dovecot IMAP server is accessible |
|
Bounce email injected via IMAP APPEND |
|
Generated DSN bounce is RFC 3464 compliant |
|
Soft bounce (4xx) format is correct |
|
BounceParser extracts X-Genro-Mail-ID |
|
BounceParser classifies hard vs soft bounces |
|
Sent message includes tracking header |
|
Bounce updates message in database |
|
Multiple bounces correlated to correct messages |
TestBounceLivePolling
File: tests/fullstack/60_imap/test_10_bounce_live.py
Marker: bounce_e2e
Live BounceReceiver polling tests.
Note
These tests require Dovecot IMAP server. Start with:
docker compose -f tests/docker/docker-compose.fulltest.yml --profile bounce up -d
Test |
Description |
|---|---|
|
Hard bounce detected by BounceReceiver |
|
Soft bounce detected and classified |
|
Bounce info included in delivery report |
|
Multiple bounces processed in single poll |
|
Processed bounce deleted from IMAP mailbox |
Test Flow Diagrams
Basic Message Flow
pytest Mail Proxy MailHog
│ │ │
│ POST /commands/add-messages │
│─────────────────────────────►│ │
│ │ │
│ 200 OK │ │
│◄─────────────────────────────│ │
│ │ │
│ POST /commands/run-now │ │
│─────────────────────────────►│ │
│ │ SMTP SEND │
│ │────────────────────►│
│ │ 250 OK │
│ │◄────────────────────│
│ │ │
│ GET /api/v2/messages │ │
│────────────────────────────────────────────────►│
│ [captured emails] │ │
│◄────────────────────────────────────────────────│
Bounce Detection Flow
pytest Mail Proxy MailHog Dovecot
│ │ │ │
│ add-messages │ │ │
│─────────────────►│ │ │
│ │ SMTP SEND │ │
│ │─────────────────►│ │
│ │ (X-Genro-Mail-ID: msg-123) │
│ │ │ │
│ IMAP APPEND (DSN bounce) │ │
│───────────────────────────────────────────────────►│
│ │ │ │
│ │ BounceReceiver polls │
│ │───────────────────────────────►│
│ │ (fetches DSN, parses) │
│ │◄───────────────────────────────│
│ │ mark_bounced(msg-123) │
│ │ │ │
│ GET /messages │ │ │
│─────────────────►│ │ │
│ [{bounce_type: "hard", ...}] │ │
│◄─────────────────│ │ │
See Also
Fullstack Integration Testing - Infrastructure setup and quick start guide
tests/fullstack/README.md- Quick reference for running tests