(t *testing.T)
| 234 | } |
| 235 | |
| 236 | func TestDkimVerify_BufferOpenFail(t *testing.T) { |
| 237 | check := testCheck(t, testZones, nil) |
| 238 | |
| 239 | ctx, cancel := context.WithCancel(context.Background()) |
| 240 | defer cancel() |
| 241 | |
| 242 | s, err := check.CheckStateForMsg(ctx, &module.MsgMetadata{ |
| 243 | ID: "test_unsigned", |
| 244 | }) |
| 245 | if err != nil { |
| 246 | t.Fatal(err) |
| 247 | } |
| 248 | |
| 249 | s.CheckConnection(ctx) |
| 250 | s.CheckSender(ctx, "joe@football.example.com") |
| 251 | s.CheckRcpt(ctx, "suzie@shopping.example.net") |
| 252 | |
| 253 | var buf buffer.Buffer |
| 254 | hdr, buf := testutils.BodyFromStr(t, verifiedMailString) |
| 255 | buf = testutils.FailingBuffer{Blob: buf.(buffer.MemoryBuffer).Slice, OpenError: errors.New("No!")} |
| 256 | |
| 257 | result := s.CheckBody(ctx, hdr, buf) |
| 258 | t.Log("auth. result:", authres.Format("", result.AuthResult)) |
| 259 | |
| 260 | if result.Reason == nil { |
| 261 | t.Fatal("No check fail reason set, auth. result:", authres.Format("", result.AuthResult)) |
| 262 | } |
| 263 | } |
| 264 | |
| 265 | func TestDkimVerify_FailClosed(t *testing.T) { |
| 266 | zones := map[string]mockdns.Zone{ |
nothing calls this directly
no test coverage detected