-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test brought in line with the others
- Loading branch information
Dusan Kasan
authored and
Dusan Kasan
committed
Apr 6, 2020
1 parent
9b69db4
commit 1ce83dc
Showing
1 changed file
with
25 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -358,6 +358,31 @@ So, "Hello".`, | |
}, | ||
}, | ||
}, | ||
12: { | ||
contentType: "multipart/related; boundary=\"000000000000ab2e2205a26de587\"", | ||
mailData: multipartRelatedExample, | ||
subject: "Saying Hello", | ||
from: []mail.Address{ | ||
{ | ||
Name: "John Doe", | ||
Address: "[email protected]", | ||
}, | ||
}, | ||
sender: mail.Address{ | ||
Name: "Michael Jones", | ||
Address: "[email protected]", | ||
}, | ||
to: []mail.Address{ | ||
{ | ||
Name: "Mary Smith", | ||
Address: "[email protected]", | ||
}, | ||
}, | ||
messageID: "[email protected]", | ||
date: parseDate("Fri, 21 Nov 1997 09:55:06 -0600"), | ||
htmlBody: "<div dir=\"ltr\"><div>Time for the egg.</div><div><br></div><div><br><br></div></div>", | ||
textBody: "Time for the egg.", | ||
}, | ||
} | ||
|
||
for index, td := range testData { | ||
|
@@ -540,27 +565,6 @@ So, "Hello".`, | |
} | ||
} | ||
|
||
func TestMultiPartRelatedEmail(t *testing.T) { | ||
email, err := Parse(strings.NewReader(multipartRelatedExample)) | ||
if err != nil { | ||
t.Errorf("[Test Multipart Related] Emailed failed to parse: %v", err) | ||
} | ||
|
||
if len(email.TextBody) == 0 { | ||
t.Errorf("[Test Multipart Related] Failed to parse multipart related at the top level.") | ||
} | ||
body := "Time for the egg." | ||
fmt.Println(email.TextBody) | ||
if email.TextBody != body { | ||
t.Errorf("Test Multipart Related] Body didn't match. \nExpected: %v,\nbut got: %v", body, email.TextBody) | ||
} | ||
|
||
html := "<div dir=\"ltr\"><div>Time for the egg.</div><div><br></div><div><br><br></div></div>" | ||
if email.HTMLBody != html { | ||
t.Errorf("Test Multipart Related] HTML didn't match. \nExpected: %v,\nbut got: %v", html, email.TextBody) | ||
} | ||
} | ||
|
||
func parseDate(in string) time.Time { | ||
out, err := time.Parse(time.RFC1123Z, in) | ||
if err != nil { | ||
|