feat: add part getter

This commit is contained in:
James Houlahan
2020-07-02 10:59:15 +02:00
parent 6ea3fc1963
commit 953150cfdb
7 changed files with 234 additions and 27 deletions

View File

@ -2,6 +2,7 @@ package parser
import (
"bytes"
"strings"
"testing"
"github.com/stretchr/testify/assert"
@ -15,7 +16,7 @@ func TestParserWrite(t *testing.T) {
buf := new(bytes.Buffer)
assert.NoError(t, w.Write(buf))
assert.Equal(t, s("text_html_octet_attachment.eml"), buf.String())
assert.Equal(t, s("text_html_octet_attachment.eml"), crlf(buf.String()))
}
func TestParserWriteNoAttachments(t *testing.T) {
@ -35,5 +36,9 @@ func TestParserWriteNoAttachments(t *testing.T) {
buf := new(bytes.Buffer)
assert.NoError(t, w.Write(buf))
assert.Equal(t, s("text_html.eml"), buf.String())
assert.Equal(t, s("text_html.eml"), crlf(buf.String()))
}
func crlf(s string) string {
return strings.ReplaceAll(s, "\r\n", "\n")
}