Add end-to-end tests for TLS RPT report ingestion and WebSocket event handling
- Implemented tests for ingesting TLS RPT reports from emails and ensuring they are stored correctly in the database. - Added tests to verify that the same report can be ingested multiple times without duplication. - Created tests for backfilling reports that were previously delivered to the inbox. - Developed WebSocket event handling tests to ensure events are correctly routed to subscribers based on mailbox ownership. - Included tests for the mail API to validate session handling, mailbox isolation, and error mapping. - Ensured that the API rejects unauthorized requests and handles malformed JSON gracefully.
This commit is contained in:
1 parent
880dced9e4
commit
f330c4324e
28 files changed
+2438
-6
No files matched your search
@@ -3,6 +3,8 @@ package port
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/google/uuid"
|
||||
|
||||
"lambdamail/protocols/internal/domain/entity"
|
||||
)
|
||||
|
||||
@@ -11,3 +13,21 @@ type ReportRepository interface {
|
||||
SaveDmarcReport(ctx context.Context, report *entity.DmarcReport) error
|
||||
SaveTlsRptReport(ctx context.Context, report *entity.TlsRptReport) error
|
||||
}
|
||||
|
||||
// StoredReportMessage is one already-delivered message that looks like a
|
||||
// report: it was addressed to a report alias and is still filed in a mailbox.
|
||||
type StoredReportMessage struct {
|
||||
MessageID uuid.UUID
|
||||
BlobID uuid.UUID
|
||||
RecipientAddress string
|
||||
}
|
||||
|
||||
// DeliveredReportStore reaches the reports that were delivered before
|
||||
// automatic ingestion existed, so they can be parsed after the fact.
|
||||
type DeliveredReportStore interface {
|
||||
// ListUningestedReports returns stored messages addressed to a report
|
||||
// alias. limit caps the batch; 0 means a full pass.
|
||||
ListUningestedReports(ctx context.Context, limit int) ([]StoredReportMessage, error)
|
||||
// MoveToReportsFolder files a backfilled message out of the inbox.
|
||||
MoveToReportsFolder(ctx context.Context, messageID uuid.UUID) error
|
||||
}
|
||||
Reference in new issue
Block a user