(t *testing.T)
| 28 | ) |
| 29 | |
| 30 | func TestMsgPipeline_SenderModifier(t *testing.T) { |
| 31 | target := testutils.Target{} |
| 32 | modifier := testutils.Modifier{ |
| 33 | InstName: "test_modifier", |
| 34 | MailFrom: map[string]string{ |
| 35 | "sender@example.com": "sender2@example.com", |
| 36 | }, |
| 37 | } |
| 38 | d := MsgPipeline{ |
| 39 | msgpipelineCfg: msgpipelineCfg{ |
| 40 | globalModifiers: modify.Group{ |
| 41 | Modifiers: []module.Modifier{modifier}, |
| 42 | }, |
| 43 | perSource: map[string]sourceBlock{}, |
| 44 | defaultSource: sourceBlock{ |
| 45 | perRcpt: map[string]*rcptBlock{}, |
| 46 | defaultRcpt: &rcptBlock{ |
| 47 | targets: []module.DeliveryTarget{&target}, |
| 48 | }, |
| 49 | }, |
| 50 | }, |
| 51 | Log: testutils.Logger(t, "msgpipeline"), |
| 52 | } |
| 53 | |
| 54 | testutils.DoTestDelivery(t, &d, "sender@example.com", []string{"rcpt1@example.com", "rcpt2@example.com"}) |
| 55 | |
| 56 | if len(target.Messages) != 1 { |
| 57 | t.Fatalf("wrong amount of messages received, want %d, got %d", 1, len(target.Messages)) |
| 58 | } |
| 59 | |
| 60 | testutils.CheckTestMessage(t, &target, 0, "sender2@example.com", []string{"rcpt1@example.com", "rcpt2@example.com"}) |
| 61 | |
| 62 | if modifier.UnclosedStates != 0 { |
| 63 | t.Fatalf("modifier state objects leak or double-closed, counter: %d", modifier.UnclosedStates) |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | func TestMsgPipeline_SenderModifier_Multiple(t *testing.T) { |
| 68 | target := testutils.Target{} |
nothing calls this directly
no test coverage detected