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

Function TestDkimVerify_BufferOpenFail

internal/check/dkim/dkim_test.go:236–263  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

234}
235
236func 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
265func TestDkimVerify_FailClosed(t *testing.T) {
266 zones := map[string]mockdns.Zone{

Callers

nothing calls this directly

Calls 7

BodyFromStrFunction · 0.92
testCheckFunction · 0.85
CheckStateForMsgMethod · 0.65
CheckConnectionMethod · 0.65
CheckSenderMethod · 0.65
CheckRcptMethod · 0.65
CheckBodyMethod · 0.65

Tested by

no test coverage detected