-
Notifications
You must be signed in to change notification settings - Fork 4
/
multipart_test.go
37 lines (29 loc) · 918 Bytes
/
multipart_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package pgpmail
import "testing"
func TestExtract(t *testing.T) {
td := new(TestData)
td.Subject = "Hello world"
td.MultipartType = "alternative"
td.Parts = []string{plainPart, htmlPart}
m := td.Message()
m.mpContent.parts[0].Body = insertCR("This is modified content.\n")
m.PackMultiparts()
if m.String() != testMultipartModified {
t.Error("modifed multipart message does not match expected output")
}
}
var testMultipartModified = insertCR(`From: [email protected]
Subject: Hello world
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=001a11c167c8f1cb3104f8f4c019
Content-Transfer-Encoding: 7bit
--001a11c167c8f1cb3104f8f4c019
Content-Type: text/plain; charset=UTF-8
This is modified content.
--001a11c167c8f1cb3104f8f4c019
Content-Type: text/html; charset=UTF-8
<div dir="ltr">1234</div>
--001a11c167c8f1cb3104f8f4c019--
`)