MCPcopy Create free account
hub / github.com/foxcpp/maddy / TestMsgPipeline_PerSourceReject

Function TestMsgPipeline_PerSourceReject

internal/msgpipeline/msgpipeline_test.go:360–392  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

358}
359
360func TestMsgPipeline_PerSourceReject(t *testing.T) {
361 target := testutils.Target{}
362 d := MsgPipeline{
363 msgpipelineCfg: msgpipelineCfg{
364 perSource: map[string]sourceBlock{
365 "sender1@example.com": {
366 perRcpt: map[string]*rcptBlock{},
367 defaultRcpt: &rcptBlock{
368 targets: []module.DeliveryTarget{&target},
369 },
370 },
371 "example.com": {
372 perRcpt: map[string]*rcptBlock{},
373 rejectErr: errors.New("go away"),
374 },
375 },
376 defaultSource: sourceBlock{rejectErr: errors.New("go away")},
377 },
378 Log: testutils.Logger(t, "msgpipeline"),
379 }
380
381 testutils.DoTestDelivery(t, &d, "sender1@example.com", []string{"rcpt@example.com"})
382
383 _, err := d.StartDelivery(context.Background(), &module.MsgMetadata{ID: "testing"}, "sender2@example.com")
384 if err == nil {
385 t.Error("expected error for delivery.StartDelivery, got nil")
386 }
387
388 _, err = d.StartDelivery(context.Background(), &module.MsgMetadata{ID: "testing"}, "sender2@example.org")
389 if err == nil {
390 t.Error("expected error for delivery.StartDelivery, got nil")
391 }
392}
393
394func TestMsgPipeline_PerRcptReject(t *testing.T) {
395 target := testutils.Target{}

Callers

nothing calls this directly

Calls 4

StartDeliveryMethod · 0.95
LoggerFunction · 0.92
DoTestDeliveryFunction · 0.92
ErrorMethod · 0.45

Tested by

no test coverage detected