(t *testing.T)
| 60 | } |
| 61 | |
| 62 | func TestMsgPipeline_AuthResults(t *testing.T) { |
| 63 | target := testutils.Target{} |
| 64 | check1, check2 := testutils.Check{ |
| 65 | BodyRes: module.CheckResult{ |
| 66 | AuthResult: []authres.Result{ |
| 67 | &authres.SPFResult{ |
| 68 | Value: authres.ResultFail, |
| 69 | From: "FROM", |
| 70 | Helo: "HELO", |
| 71 | }, |
| 72 | }, |
| 73 | }, |
| 74 | }, testutils.Check{ |
| 75 | BodyRes: module.CheckResult{ |
| 76 | AuthResult: []authres.Result{ |
| 77 | &authres.SPFResult{ |
| 78 | Value: authres.ResultFail, |
| 79 | From: "FROM2", |
| 80 | Helo: "HELO2", |
| 81 | }, |
| 82 | }, |
| 83 | }, |
| 84 | } |
| 85 | d := MsgPipeline{ |
| 86 | msgpipelineCfg: msgpipelineCfg{ |
| 87 | globalChecks: []module.Check{&check1, &check2}, |
| 88 | perSource: map[string]sourceBlock{}, |
| 89 | defaultSource: sourceBlock{ |
| 90 | perRcpt: map[string]*rcptBlock{}, |
| 91 | defaultRcpt: &rcptBlock{ |
| 92 | targets: []module.DeliveryTarget{&target}, |
| 93 | }, |
| 94 | }, |
| 95 | }, |
| 96 | Hostname: "TEST-HOST", |
| 97 | Log: testutils.Logger(t, "msgpipeline"), |
| 98 | } |
| 99 | |
| 100 | testutils.DoTestDelivery(t, &d, "whatever@whatever", []string{"whatever@whatever"}) |
| 101 | |
| 102 | if len(target.Messages) != 1 { |
| 103 | t.Fatalf("wrong amount of messages received, want %d, got %d", 1, len(target.Messages)) |
| 104 | } |
| 105 | |
| 106 | authRes := target.Messages[0].Header.Get("Authentication-Results") |
| 107 | id, parsed, err := authres.Parse(authRes) |
| 108 | if err != nil { |
| 109 | t.Fatalf("failed to parse results") |
| 110 | } |
| 111 | if id != "TEST-HOST" { |
| 112 | t.Fatalf("wrong authres identifier") |
| 113 | } |
| 114 | if len(parsed) != 2 { |
| 115 | t.Fatalf("wrong amount of parts, want %d, got %d", 2, len(parsed)) |
| 116 | } |
| 117 | |
| 118 | var seen1, seen2 bool |
| 119 | for _, parts := range parsed { |
nothing calls this directly
no test coverage detected