test(ingest): match the refusal text of a non-publisher by suffix

- the client sees the recipient in front of the server message
This commit is contained in:
tgiachi 2026-11-10 12:37:13 +01:00
commit b6f776530f

View file

@ -2,6 +2,7 @@ package ingest
import (
"errors"
"strings"
"testing"
"github.com/emersion/go-smtp"
@ -16,7 +17,7 @@ func TestANonPublisherIsRefusedPermanentlyByANewsletter(t *testing.T) {
res := deliver(t, st.addr, "alice@example.com", []string{"dev@example.org"})
var se *smtp.SMTPError
if !errors.As(res["dev@example.org"], &se) || se.Code != 550 ||
se.EnhancedCode != (smtp.EnhancedCode{5, 7, 1}) || se.Message != "only the publishers of this list may post" {
se.EnhancedCode != (smtp.EnhancedCode{5, 7, 1}) || !strings.HasSuffix(se.Message, "only the publishers of this list may post") {
t.Fatalf("want 550 5.7.1, got %v", res["dev@example.org"])
}
if st.queued(t) != 0 {