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

Function TestMsgPipeline_MalformedSource

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

Source from the content-addressed store, hash-verified

605}
606
607func TestMsgPipeline_MalformedSource(t *testing.T) {
608 target := testutils.Target{}
609 d := MsgPipeline{
610 msgpipelineCfg: msgpipelineCfg{
611 perSource: map[string]sourceBlock{},
612 defaultSource: sourceBlock{
613 perRcpt: map[string]*rcptBlock{
614 "postmaster": {
615 targets: []module.DeliveryTarget{&target},
616 },
617 "sender@example.com": {
618 targets: []module.DeliveryTarget{&target},
619 },
620 "example.com": {
621 targets: []module.DeliveryTarget{&target},
622 },
623 },
624 },
625 },
626 Log: testutils.Logger(t, "msgpipeline"),
627 }
628
629 // Simple checks for violations that can make msgpipeline misbehave.
630 for _, addr := range []string{"not_postmaster_but_no_at_sign", "@no_mailbox", "no_domain@"} {
631 _, err := d.StartDelivery(context.Background(), &module.MsgMetadata{ID: "testing"}, addr)
632 if err == nil {
633 t.Errorf("%s is accepted as valid address", addr)
634 }
635 }
636}
637
638func TestMsgPipeline_TwoRcptToOneTarget(t *testing.T) {
639 target := testutils.Target{}

Callers

nothing calls this directly

Calls 2

StartDeliveryMethod · 0.95
LoggerFunction · 0.92

Tested by

no test coverage detected