MCPcopy Create free account
hub / github.com/buggregator/server / TestParseEmail_Multipart

Function TestParseEmail_Multipart

modules/smtp/handler_test.go:55–68  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

53}
54
55func TestParseEmail_Multipart(t *testing.T) {
56 raw := []byte("From: sender@example.com\r\nTo: recipient@example.com\r\nSubject: Multipart Test\r\nContent-Type: multipart/alternative; boundary=\"boundary123\"\r\nMessage-ID: <multi@example.com>\r\n\r\n--boundary123\r\nContent-Type: text/plain\r\n\r\nPlain text body\r\n--boundary123\r\nContent-Type: text/html\r\n\r\n<p>HTML body</p>\r\n--boundary123--")
57
58 parsed, _, err := parseEmail(raw, []string{"recipient@example.com"})
59 if err != nil {
60 t.Fatal(err)
61 }
62 if !strings.Contains(parsed.Text, "Plain text body") {
63 t.Errorf("Text = %q", parsed.Text)
64 }
65 if !strings.Contains(parsed.HTML, "HTML body") {
66 t.Errorf("HTML = %q", parsed.HTML)
67 }
68}
69
70func TestParseEmail_BCC(t *testing.T) {
71 raw := []byte("From: sender@example.com\r\nTo: visible@example.com\r\nSubject: BCC Test\r\nContent-Type: text/plain\r\n\r\ntest")

Callers

nothing calls this directly

Calls 1

parseEmailFunction · 0.85

Tested by

no test coverage detected